authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-10-08 22:03:32-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-08 22:03:32-07:00
logb000eac171318bf0130865387ae33523eecd3019
treee0d11f5e9bfe3fa6c1e89e018da8ad8a122b8a39
parentc9fa1367caff4cd6595386814e1f8bb950d3d3ef
signature Signed by PGP key B5690EEEBB952194

refactor(providers): adapter factories yield their services (#17381)


27 files changed, 270 insertions(+), 1030 deletions(-)

apps/server/scripts/record-grok-acp-replay-fixture.ts+1-8
......@@ -16,7 +16,6 @@ import { HostProcessEnvironment, HostProcessPlatform } from "@t3tools/shared/hos
1616import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
1717import * as Clock from "effect/Clock";
1818import * as Console from "effect/Console";
19import * as Crypto from "effect/Crypto";
2019import * as Effect from "effect/Effect";
2120import * as FileSystem from "effect/FileSystem";
2221import * as Layer from "effect/Layer";
......@@ -25,7 +24,6 @@ import * as Schema from "effect/Schema";
2524import { ChildProcessSpawner } from "effect/process";
2625import type * as EffectAcpProtocol from "effect-acp/protocol";
2726
28import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
2927import { layerTestProviderHost } from "@t3tools/provider-testing/host";
3028import {
3129 GROK_DEFAULT_INSTANCE_ID,
......@@ -447,16 +445,11 @@ const recordScenario = Effect.fn("recordGrokScenario")(function* (fixtureName: s
447445 Effect.gen(function* () {
448446 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
449447 const environment = yield* HostProcessEnvironment;
450 const adapter = makeGrokAdapterV2({
448 const adapter = yield* makeGrokAdapterV2({
451449 instanceId: GROK_DEFAULT_INSTANCE_ID,
452450 settings,
453451 environment,
454452 hostPlatform: yield* HostProcessPlatform,
455 childProcessSpawner,
456 crypto: yield* Crypto.Crypto,
457 fileSystem: yield* FileSystem.FileSystem,
458 idAllocator: yield* IdAllocator.IdAllocatorV2,
459 host: yield* ProviderHost.ProviderHost,
460453 selfInvocation: yield* resolveSelfInvocation(),
461454 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,
462455 // Production's runtime factory, with the protocol logger teeing raw lines.
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts+86-623
......@@ -30,7 +30,6 @@ import { GrokSettings } from "@t3tools/provider-grok/settings";
3030import { HostProcessIsExecutable, HostProcessPlatform } from "@t3tools/shared/hostProcess";
3131import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
3232import * as DateTime from "effect/DateTime";
33import * as Crypto from "effect/Crypto";
3433import * as Deferred from "effect/Deferred";
3534import type * as Duration from "effect/Duration";
3635import * as Cause from "effect/Cause";
......@@ -54,7 +53,6 @@ import * as EffectAcpErrors from "effect-acp/errors";
5453import type * as EffectAcpProtocol from "effect-acp/protocol";
5554import type * as EffectAcpSchema from "effect-acp/compat";
5655
57import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
5856import { layerTestProviderHost } from "@t3tools/provider-testing/host";
5957import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
6058import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
......@@ -610,12 +608,8 @@ describe("AcpAdapterV2", () => {
610608 const path = yield* Path.Path;
611609 const instanceId = ProviderInstanceId.make(`vibe-retry-${outcome}`);
612610 const threadId = ThreadId.make(`thread-vibe-retry-${outcome}`);
613 const adapter = makeAcpAdapterV2({
614 crypto: yield* Crypto.Crypto,
611 const adapter = yield* makeAcpAdapterV2({
615612 instanceId,
616 fileSystem: yield* FileSystem.FileSystem,
617 idAllocator: yield* IdAllocator.IdAllocatorV2,
618 host: yield* ProviderHost.ProviderHost,
619613 selfInvocation: yield* resolveSelfInvocation(),
620614 flavor: {
621615 driver: ProviderDriverKind.make("acpRegistry"),
......@@ -709,10 +703,7 @@ describe("AcpAdapterV2", () => {
709703 it.effect("starts the MCP bridge directly from the self-contained runtime", () =>
710704 Effect.gen(function* () {
711705 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
712 const fileSystem = yield* FileSystem.FileSystem;
713 const idAllocator = yield* IdAllocator.IdAllocatorV2;
714706 const path = yield* Path.Path;
715 const host = yield* ProviderHost.ProviderHost;
716707 const selfInvocation = yield* resolveSelfInvocation().pipe(
717708 Effect.provideService(HostProcessIsExecutable, true),
718709 );
......@@ -739,8 +730,7 @@ describe("AcpAdapterV2", () => {
739730
740731 let runtimeInput: AcpAdapterV2RuntimeInput | undefined;
741732 const makeRuntime = makeMockRuntime({ childProcessSpawner, mockAgentPath });
742 const adapter = makeAcpAdapterV2({
743 crypto: yield* Crypto.Crypto,
733 const adapter = yield* makeAcpAdapterV2({
744734 instanceId,
745735 flavor: {
746736 driver: ACP_TEST_DRIVER,
......@@ -750,9 +740,6 @@ describe("AcpAdapterV2", () => {
750740 runtimeInput = input;
751741 }).pipe(Effect.andThen(makeRuntime(input))),
752742 },
753 fileSystem,
754 idAllocator,
755 host,
756743 selfInvocation,
757744 });
758745 const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({
......@@ -782,10 +769,7 @@ describe("AcpAdapterV2", () => {
782769 it.live("refreshes ACP prompt instructions when the interaction mode changes", () =>
783770 Effect.gen(function* () {
784771 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
785 const fileSystem = yield* FileSystem.FileSystem;
786 const idAllocator = yield* IdAllocator.IdAllocatorV2;
787772 const path = yield* Path.Path;
788 const host = yield* ProviderHost.ProviderHost;
789773 const selfInvocation = yield* resolveSelfInvocation();
790774 const mockAgentPath = yield* path.fromFileUrl(
791775 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -805,17 +789,13 @@ describe("AcpAdapterV2", () => {
805789 yield* Effect.addFinalizer(() =>
806790 Effect.sync(() => McpProviderSession.clearMcpProviderSession(threadId)),
807791 );
808 const adapter = makeAcpAdapterV2({
809 crypto: yield* Crypto.Crypto,
792 const adapter = yield* makeAcpAdapterV2({
810793 instanceId,
811794 flavor: {
812795 driver: ACP_TEST_DRIVER,
813796 capabilities: AcpProviderCapabilitiesV2,
814797 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
815798 },
816 fileSystem,
817 idAllocator,
818 host,
819799 selfInvocation,
820800 });
821801 const policy = (interactionMode: "default" | "plan") =>
......@@ -909,10 +889,7 @@ describe("AcpAdapterV2", () => {
909889 it.effect("starts a new replay message after ACP v2 plan boundaries", () =>
910890 Effect.gen(function* () {
911891 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
912 const fileSystem = yield* FileSystem.FileSystem;
913 const idAllocator = yield* IdAllocator.IdAllocatorV2;
914892 const path = yield* Path.Path;
915 const host = yield* ProviderHost.ProviderHost;
916893 const selfInvocation = yield* resolveSelfInvocation();
917894 const mockAgentPath = yield* path.fromFileUrl(
918895 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -920,8 +897,7 @@ describe("AcpAdapterV2", () => {
920897 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
921898 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
922899 const instanceId = ProviderInstanceId.make("acp-test-v2-plan-replay-boundary");
923 const adapter = makeAcpAdapterV2({
924 crypto: yield* Crypto.Crypto,
900 const adapter = yield* makeAcpAdapterV2({
925901 instanceId,
926902 flavor: {
927903 driver: ACP_TEST_DRIVER,
......@@ -938,9 +914,6 @@ describe("AcpAdapterV2", () => {
938914 }),
939915 }),
940916 },
941 fileSystem,
942 idAllocator,
943 host,
944917 selfInvocation,
945918 });
946919 const threadId = ThreadId.make("thread-acp-v2-plan-replay-boundary");
......@@ -1043,12 +1016,8 @@ describe("AcpAdapterV2", () => {
10431016 ];
10441017 };
10451018 const instanceId = ProviderInstanceId.make("devin-streamed-write");
1046 const adapter = makeAcpAdapterV2({
1019 const adapter = yield* makeAcpAdapterV2({
10471020 instanceId,
1048 crypto: yield* Crypto.Crypto,
1049 fileSystem: yield* FileSystem.FileSystem,
1050 idAllocator: yield* IdAllocator.IdAllocatorV2,
1051 host: yield* ProviderHost.ProviderHost,
10521021 selfInvocation: yield* resolveSelfInvocation(),
10531022 flavor: {
10541023 driver: ACP_TEST_DRIVER,
......@@ -1178,7 +1147,6 @@ describe("AcpAdapterV2", () => {
11781147 it.effect("keeps Devin parent paragraphs intact while projecting native child work", () =>
11791148 Effect.gen(function* () {
11801149 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1181 const idAllocator = yield* IdAllocator.IdAllocatorV2;
11821150 const path = yield* Path.Path;
11831151 const mockAgentPath = yield* path.fromFileUrl(
11841152 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -1187,14 +1155,10 @@ describe("AcpAdapterV2", () => {
11871155 let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
11881156 let createTerminal: Parameters<Runtime["handleCreateTerminal"]>[0] | undefined;
11891157 const instanceId = ProviderInstanceId.make("devin-replay");
1190 const adapter = makeAcpAdapterV2({
1158 const adapter = yield* makeAcpAdapterV2({
11911159 instanceId,
11921160 // Production Devin runs commands through client terminals.
11931161 clientTerminals: { childProcessSpawner, shellCommands: true },
1194 crypto: yield* Crypto.Crypto,
1195 fileSystem: yield* FileSystem.FileSystem,
1196 idAllocator,
1197 host: yield* ProviderHost.ProviderHost,
11981162 selfInvocation: yield* resolveSelfInvocation(),
11991163 flavor: {
12001164 driver: ACP_TEST_DRIVER,
......@@ -1511,10 +1475,7 @@ describe("AcpAdapterV2", () => {
15111475 it.effect("projects ACP v2 fidelity updates into first-class orchestration items", () =>
15121476 Effect.gen(function* () {
15131477 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1514 const fileSystem = yield* FileSystem.FileSystem;
1515 const idAllocator = yield* IdAllocator.IdAllocatorV2;
15161478 const path = yield* Path.Path;
1517 const host = yield* ProviderHost.ProviderHost;
15181479 const selfInvocation = yield* resolveSelfInvocation();
15191480 const mockAgentPath = yield* path.fromFileUrl(
15201481 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -1522,8 +1483,7 @@ describe("AcpAdapterV2", () => {
15221483 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
15231484 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
15241485 const instanceId = ProviderInstanceId.make("acp-test-v2-fidelity");
1525 const adapter = makeAcpAdapterV2({
1526 crypto: yield* Crypto.Crypto,
1486 const adapter = yield* makeAcpAdapterV2({
15271487 instanceId,
15281488 flavor: {
15291489 driver: ACP_TEST_DRIVER,
......@@ -1541,9 +1501,6 @@ describe("AcpAdapterV2", () => {
15411501 }),
15421502 }),
15431503 },
1544 fileSystem,
1545 idAllocator,
1546 host,
15471504 selfInvocation,
15481505 });
15491506 const threadId = ThreadId.make("thread-acp-v2-fidelity");
......@@ -1705,18 +1662,15 @@ describe("AcpAdapterV2", () => {
17051662 () =>
17061663 Effect.gen(function* () {
17071664 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1708 const fileSystem = yield* FileSystem.FileSystem;
17091665 const idAllocator = yield* IdAllocator.IdAllocatorV2;
17101666 const path = yield* Path.Path;
1711 const host = yield* ProviderHost.ProviderHost;
17121667 const selfInvocation = yield* resolveSelfInvocation();
17131668 const mockAgentPath = yield* path.fromFileUrl(
17141669 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
17151670 );
17161671 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
17171672 const instanceId = ProviderInstanceId.make("acp-test-eager-resume");
1718 const adapter = makeAcpAdapterV2({
1719 crypto: yield* Crypto.Crypto,
1673 const adapter = yield* makeAcpAdapterV2({
17201674 instanceId,
17211675 flavor: {
17221676 driver: ACP_TEST_DRIVER,
......@@ -1727,9 +1681,6 @@ describe("AcpAdapterV2", () => {
17271681 protocolEvents,
17281682 }),
17291683 },
1730 fileSystem,
1731 idAllocator,
1732 host,
17331684 selfInvocation,
17341685 });
17351686 const threadId = ThreadId.make("thread-acp-eager-resume");
......@@ -1790,18 +1741,15 @@ describe("AcpAdapterV2", () => {
17901741 it.live("preserves new-session fallback when an eager ACP session load is stale", () =>
17911742 Effect.gen(function* () {
17921743 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1793 const fileSystem = yield* FileSystem.FileSystem;
17941744 const idAllocator = yield* IdAllocator.IdAllocatorV2;
17951745 const path = yield* Path.Path;
1796 const host = yield* ProviderHost.ProviderHost;
17971746 const selfInvocation = yield* resolveSelfInvocation();
17981747 const mockAgentPath = yield* path.fromFileUrl(
17991748 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
18001749 );
18011750 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
18021751 const instanceId = ProviderInstanceId.make("acp-test-stale-eager-resume");
1803 const adapter = makeAcpAdapterV2({
1804 crypto: yield* Crypto.Crypto,
1752 const adapter = yield* makeAcpAdapterV2({
18051753 instanceId,
18061754 flavor: {
18071755 driver: ACP_TEST_DRIVER,
......@@ -1814,9 +1762,6 @@ describe("AcpAdapterV2", () => {
18141762 runtimeOrdinal === 1 ? { T3_ACP_FAIL_LOAD_SESSION: "1" } : {},
18151763 }),
18161764 },
1817 fileSystem,
1818 idAllocator,
1819 host,
18201765 selfInvocation,
18211766 });
18221767 const threadId = ThreadId.make("thread-acp-stale-eager-resume");
......@@ -1936,10 +1881,7 @@ describe("AcpAdapterV2", () => {
19361881 it.live("replaces an unexpectedly terminated ACP runtime before the next turn", () =>
19371882 Effect.gen(function* () {
19381883 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1939 const fileSystem = yield* FileSystem.FileSystem;
1940 const idAllocator = yield* IdAllocator.IdAllocatorV2;
19411884 const path = yield* Path.Path;
1942 const host = yield* ProviderHost.ProviderHost;
19431885 const selfInvocation = yield* resolveSelfInvocation();
19441886 const mockAgentPath = yield* path.fromFileUrl(
19451887 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -1955,8 +1897,7 @@ describe("AcpAdapterV2", () => {
19551897 },
19561898 });
19571899 const instanceId = ProviderInstanceId.make("acp-test-unexpected-termination");
1958 const adapter = makeAcpAdapterV2({
1959 crypto: yield* Crypto.Crypto,
1900 const adapter = yield* makeAcpAdapterV2({
19601901 instanceId,
19611902 flavor: {
19621903 driver: ACP_TEST_DRIVER,
......@@ -1966,9 +1907,6 @@ describe("AcpAdapterV2", () => {
19661907 runtimeInputs.push(runtimeInput);
19671908 }).pipe(Effect.andThen(baseMakeRuntime(runtimeInput))),
19681909 },
1969 fileSystem,
1970 idAllocator,
1971 host,
19721910 selfInvocation,
19731911 });
19741912 const threadId = ThreadId.make("thread-acp-unexpected-termination");
......@@ -2020,9 +1958,7 @@ describe("AcpAdapterV2", () => {
20201958 if ((yield* HostProcessPlatform) !== "linux") return;
20211959 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
20221960 const fileSystem = yield* FileSystem.FileSystem;
2023 const idAllocator = yield* IdAllocator.IdAllocatorV2;
20241961 const path = yield* Path.Path;
2025 const host = yield* ProviderHost.ProviderHost;
20261962 const selfInvocation = yield* resolveSelfInvocation();
20271963 const mockAgentPath = yield* path.fromFileUrl(
20281964 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2034,8 +1970,7 @@ describe("AcpAdapterV2", () => {
20341970 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),
20351971 );
20361972 const instanceId = ProviderInstanceId.make("acp-test-provider-exit");
2037 const adapter = makeAcpAdapterV2({
2038 crypto: yield* Crypto.Crypto,
1973 const adapter = yield* makeAcpAdapterV2({
20391974 instanceId,
20401975 flavor: {
20411976 driver: ACP_TEST_DRIVER,
......@@ -2055,9 +1990,6 @@ describe("AcpAdapterV2", () => {
20551990 },
20561991 }),
20571992 },
2058 fileSystem,
2059 idAllocator,
2060 host,
20611993 selfInvocation,
20621994 });
20631995 const threadId = ThreadId.make("thread-acp-provider-exit-running-command");
......@@ -2104,10 +2036,7 @@ describe("AcpAdapterV2", () => {
21042036 Effect.gen(function* () {
21052037 if ((yield* HostProcessPlatform) !== "linux") return;
21062038 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2107 const fileSystem = yield* FileSystem.FileSystem;
2108 const idAllocator = yield* IdAllocator.IdAllocatorV2;
21092039 const path = yield* Path.Path;
2110 const host = yield* ProviderHost.ProviderHost;
21112040 const selfInvocation = yield* resolveSelfInvocation();
21122041 const mockAgentPath = yield* path.fromFileUrl(
21132042 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2116,8 +2045,7 @@ describe("AcpAdapterV2", () => {
21162045 | AcpSessionRuntime.AcpSessionRuntime["Service"]["processContainment"]
21172046 | undefined;
21182047 const instanceId = ProviderInstanceId.make("acp-test-cgroup-unavailable");
2119 const adapter = makeAcpAdapterV2({
2120 crypto: yield* Crypto.Crypto,
2048 const adapter = yield* makeAcpAdapterV2({
21212049 instanceId,
21222050 flavor: {
21232051 driver: ACP_TEST_DRIVER,
......@@ -2134,9 +2062,6 @@ describe("AcpAdapterV2", () => {
21342062 },
21352063 }),
21362064 },
2137 fileSystem,
2138 idAllocator,
2139 host,
21402065 selfInvocation,
21412066 });
21422067 const threadId = ThreadId.make("thread-acp-cgroup-unavailable");
......@@ -2160,10 +2085,7 @@ describe("AcpAdapterV2", () => {
21602085 it.live("cleans a cgroup lease when the pre-exec join wrapper fails", () =>
21612086 Effect.gen(function* () {
21622087 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2163 const fileSystem = yield* FileSystem.FileSystem;
2164 const idAllocator = yield* IdAllocator.IdAllocatorV2;
21652088 const path = yield* Path.Path;
2166 const host = yield* ProviderHost.ProviderHost;
21672089 const selfInvocation = yield* resolveSelfInvocation();
21682090 const mockAgentPath = yield* path.fromFileUrl(
21692091 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2192,8 +2114,7 @@ describe("AcpAdapterV2", () => {
21922114 },
21932115 };
21942116 const instanceId = ProviderInstanceId.make("acp-test-cgroup-join-failure");
2195 const adapter = makeAcpAdapterV2({
2196 crypto: yield* Crypto.Crypto,
2117 const adapter = yield* makeAcpAdapterV2({
21972118 instanceId,
21982119 flavor: {
21992120 driver: ACP_TEST_DRIVER,
......@@ -2206,9 +2127,6 @@ describe("AcpAdapterV2", () => {
22062127 ownDetachedProcessGroup: true,
22072128 }),
22082129 },
2209 fileSystem,
2210 idAllocator,
2211 host,
22122130 selfInvocation,
22132131 });
22142132 const threadId = ThreadId.make("thread-acp-cgroup-join-failure");
......@@ -2238,10 +2156,7 @@ describe("AcpAdapterV2", () => {
22382156 it.effect("negotiates and executes optional native session forks through the ACP runtime", () =>
22392157 Effect.gen(function* () {
22402158 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2241 const fileSystem = yield* FileSystem.FileSystem;
2242 const idAllocator = yield* IdAllocator.IdAllocatorV2;
22432159 const path = yield* Path.Path;
2244 const host = yield* ProviderHost.ProviderHost;
22452160 const selfInvocation = yield* resolveSelfInvocation();
22462161 const mockAgentPath = yield* path.fromFileUrl(
22472162 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2275,17 +2190,13 @@ describe("AcpAdapterV2", () => {
22752190 });
22762191
22772192 const instanceId = ProviderInstanceId.make("acp-test");
2278 const adapter = makeAcpAdapterV2({
2279 crypto: yield* Crypto.Crypto,
2193 const adapter = yield* makeAcpAdapterV2({
22802194 instanceId,
22812195 flavor: {
22822196 driver: ACP_TEST_DRIVER,
22832197 capabilities: AcpProviderCapabilitiesV2,
22842198 makeRuntime,
22852199 },
2286 fileSystem,
2287 idAllocator,
2288 host,
22892200 selfInvocation,
22902201 clientTerminals: { childProcessSpawner },
22912202 });
......@@ -2451,9 +2362,7 @@ describe("AcpAdapterV2", () => {
24512362 Effect.gen(function* () {
24522363 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
24532364 const fileSystem = yield* FileSystem.FileSystem;
2454 const idAllocator = yield* IdAllocator.IdAllocatorV2;
24552365 const path = yield* Path.Path;
2456 const host = yield* ProviderHost.ProviderHost;
24572366 const selfInvocation = yield* resolveSelfInvocation();
24582367 const mockAgentPath = yield* path.fromFileUrl(
24592368 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2465,8 +2374,7 @@ describe("AcpAdapterV2", () => {
24652374 const probeLogPath = path.join(workspace, "fs-probe.jsonl");
24662375 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
24672376 const instanceId = ProviderInstanceId.make("acp-test-no-client-fs");
2468 const adapter = makeAcpAdapterV2({
2469 crypto: yield* Crypto.Crypto,
2377 const adapter = yield* makeAcpAdapterV2({
24702378 instanceId,
24712379 flavor: {
24722380 driver: ACP_TEST_DRIVER,
......@@ -2481,9 +2389,6 @@ describe("AcpAdapterV2", () => {
24812389 },
24822390 }),
24832391 },
2484 fileSystem,
2485 idAllocator,
2486 host,
24872392 selfInvocation,
24882393 });
24892394 const threadId = ThreadId.make("thread-acp-no-client-fs");
......@@ -2547,10 +2452,7 @@ describe("AcpAdapterV2", () => {
25472452 it.effect("does not turn an unknown permission approval into an execute grant", () =>
25482453 Effect.gen(function* () {
25492454 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2550 const fileSystem = yield* FileSystem.FileSystem;
2551 const idAllocator = yield* IdAllocator.IdAllocatorV2;
25522455 const path = yield* Path.Path;
2553 const host = yield* ProviderHost.ProviderHost;
25542456 const selfInvocation = yield* resolveSelfInvocation();
25552457 const mockAgentPath = yield* path.fromFileUrl(
25562458 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2576,8 +2478,7 @@ describe("AcpAdapterV2", () => {
25762478 }),
25772479 });
25782480 const instanceId = ProviderInstanceId.make("acp-test-unknown-permission-grant");
2579 const adapter = makeAcpAdapterV2({
2580 crypto: yield* Crypto.Crypto,
2481 const adapter = yield* makeAcpAdapterV2({
25812482 instanceId,
25822483 flavor: {
25832484 driver: ACP_TEST_DRIVER,
......@@ -2588,9 +2489,6 @@ describe("AcpAdapterV2", () => {
25882489 runtimeInput = input;
25892490 }).pipe(Effect.andThen(makeRuntime(input))),
25902491 },
2591 fileSystem,
2592 idAllocator,
2593 host,
25942492 selfInvocation,
25952493 clientTerminals: { childProcessSpawner },
25962494 });
......@@ -2684,26 +2582,19 @@ describe("AcpAdapterV2", () => {
26842582 it.effect("fails missing native ACP session ids through the typed start-turn error channel", () =>
26852583 Effect.gen(function* () {
26862584 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2687 const fileSystem = yield* FileSystem.FileSystem;
2688 const idAllocator = yield* IdAllocator.IdAllocatorV2;
26892585 const path = yield* Path.Path;
2690 const host = yield* ProviderHost.ProviderHost;
26912586 const selfInvocation = yield* resolveSelfInvocation();
26922587 const mockAgentPath = yield* path.fromFileUrl(
26932588 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
26942589 );
26952590 const instanceId = ProviderInstanceId.make("acp-test-missing-native-thread");
2696 const adapter = makeAcpAdapterV2({
2697 crypto: yield* Crypto.Crypto,
2591 const adapter = yield* makeAcpAdapterV2({
26982592 instanceId,
26992593 flavor: {
27002594 driver: ACP_TEST_DRIVER,
27012595 capabilities: AcpProviderCapabilitiesV2,
27022596 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),
27032597 },
2704 fileSystem,
2705 idAllocator,
2706 host,
27072598 selfInvocation,
27082599 });
27092600 const threadId = ThreadId.make("thread-acp-missing-native-thread");
......@@ -2746,10 +2637,8 @@ describe("AcpAdapterV2", () => {
27462637 it.effect("replaces the ACP session and clears conversation state on rollback", () =>
27472638 Effect.gen(function* () {
27482639 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2749 const fileSystem = yield* FileSystem.FileSystem;
27502640 const idAllocator = yield* IdAllocator.IdAllocatorV2;
27512641 const path = yield* Path.Path;
2752 const host = yield* ProviderHost.ProviderHost;
27532642 const selfInvocation = yield* resolveSelfInvocation();
27542643 const mockAgentPath = yield* path.fromFileUrl(
27552644 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2774,8 +2663,7 @@ describe("AcpAdapterV2", () => {
27742663 mockAgentPath,
27752664 environment: { T3_ACP_PROMPT_DELAY_MS: "100" },
27762665 });
2777 const adapter = makeAcpAdapterV2({
2778 crypto: yield* Crypto.Crypto,
2666 const adapter = yield* makeAcpAdapterV2({
27792667 instanceId,
27802668 flavor: {
27812669 driver: ACP_TEST_DRIVER,
......@@ -2785,9 +2673,6 @@ describe("AcpAdapterV2", () => {
27852673 Effect.andThen(makeRuntime(runtimeInput)),
27862674 ),
27872675 },
2788 fileSystem,
2789 idAllocator,
2790 host,
27912676 selfInvocation,
27922677 });
27932678 const threadId = ThreadId.make("thread-acp-rollback-session");
......@@ -2913,10 +2798,7 @@ describe("AcpAdapterV2", () => {
29132798 it.effect("quarantines callbacks from a failed rollback replacement before retrying", () =>
29142799 Effect.gen(function* () {
29152800 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2916 const fileSystem = yield* FileSystem.FileSystem;
2917 const idAllocator = yield* IdAllocator.IdAllocatorV2;
29182801 const path = yield* Path.Path;
2919 const host = yield* ProviderHost.ProviderHost;
29202802 const selfInvocation = yield* resolveSelfInvocation();
29212803 const mockAgentPath = yield* path.fromFileUrl(
29222804 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -2979,8 +2861,7 @@ describe("AcpAdapterV2", () => {
29792861 },
29802862 });
29812863 const instanceId = ProviderInstanceId.make("acp-test-rollback-retry-generation");
2982 const adapter = makeAcpAdapterV2({
2983 crypto: yield* Crypto.Crypto,
2864 const adapter = yield* makeAcpAdapterV2({
29842865 instanceId,
29852866 flavor: {
29862867 driver: ACP_TEST_DRIVER,
......@@ -2998,9 +2879,6 @@ describe("AcpAdapterV2", () => {
29982879 }),
29992880 makeRuntime,
30002881 },
3001 fileSystem,
3002 idAllocator,
3003 host,
30042882 selfInvocation,
30052883 continuationRequests: { offer: () => Effect.void },
30062884 });
......@@ -3074,10 +2952,8 @@ describe("AcpAdapterV2", () => {
30742952 it.effect("keeps the original ACP session usable when a staged replacement terminates", () =>
30752953 Effect.gen(function* () {
30762954 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3077 const fileSystem = yield* FileSystem.FileSystem;
30782955 const idAllocator = yield* IdAllocator.IdAllocatorV2;
30792956 const path = yield* Path.Path;
3080 const host = yield* ProviderHost.ProviderHost;
30812957 const selfInvocation = yield* resolveSelfInvocation();
30822958 const mockAgentPath = yield* path.fromFileUrl(
30832959 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -3109,17 +2985,13 @@ describe("AcpAdapterV2", () => {
31092985 };
31102986 });
31112987 const instanceId = ProviderInstanceId.make("acp-test-rollback-failure-compensation");
3112 const adapter = makeAcpAdapterV2({
3113 crypto: yield* Crypto.Crypto,
2988 const adapter = yield* makeAcpAdapterV2({
31142989 instanceId,
31152990 flavor: {
31162991 driver: ACP_TEST_DRIVER,
31172992 capabilities: AcpProviderCapabilitiesV2,
31182993 makeRuntime,
31192994 },
3120 fileSystem,
3121 idAllocator,
3122 host,
31232995 selfInvocation,
31242996 });
31252997 const threadId = ThreadId.make("thread-acp-rollback-failure-compensation");
......@@ -3190,27 +3062,20 @@ describe("AcpAdapterV2", () => {
31903062 it.effect("closes an idle ACP session exactly once through the transition permit", () =>
31913063 Effect.gen(function* () {
31923064 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3193 const fileSystem = yield* FileSystem.FileSystem;
3194 const idAllocator = yield* IdAllocator.IdAllocatorV2;
31953065 const path = yield* Path.Path;
3196 const host = yield* ProviderHost.ProviderHost;
31973066 const selfInvocation = yield* resolveSelfInvocation();
31983067 const mockAgentPath = yield* path.fromFileUrl(
31993068 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
32003069 );
32013070 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
32023071 const instanceId = ProviderInstanceId.make("acp-test");
3203 const adapter = makeAcpAdapterV2({
3204 crypto: yield* Crypto.Crypto,
3072 const adapter = yield* makeAcpAdapterV2({
32053073 instanceId,
32063074 flavor: {
32073075 driver: ACP_TEST_DRIVER,
32083076 capabilities: AcpProviderCapabilitiesV2,
32093077 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
32103078 },
3211 fileSystem,
3212 idAllocator,
3213 host,
32143079 selfInvocation,
32153080 });
32163081 const threadId = ThreadId.make("thread-acp-idle-finalizer");
......@@ -3241,26 +3106,18 @@ describe("AcpAdapterV2", () => {
32413106 (model) =>
32423107 Effect.gen(function* () {
32433108 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3244 const fileSystem = yield* FileSystem.FileSystem;
3245 const idAllocator = yield* IdAllocator.IdAllocatorV2;
32463109 const path = yield* Path.Path;
3247 const host = yield* ProviderHost.ProviderHost;
32483110 const selfInvocation = yield* resolveSelfInvocation();
32493111 const mockAgentPath = yield* path.fromFileUrl(
32503112 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
32513113 );
32523114 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
32533115 const instanceId = ProviderInstanceId.make("grok-test");
3254 const adapter = makeGrokAdapterV2({
3116 const adapter = yield* makeGrokAdapterV2({
32553117 instanceId,
32563118 settings: DEFAULT_GROK_SETTINGS,
32573119 environment: {},
32583120 hostPlatform: yield* HostProcessPlatform,
3259 childProcessSpawner,
3260 crypto: yield* Crypto.Crypto,
3261 fileSystem,
3262 idAllocator,
3263 host,
32643121 selfInvocation: yield* resolveSelfInvocation(),
32653122 // Production Grok runtimes are wrapped by the x.ai prompt runtime.
32663123 makeRuntime: (input) =>
......@@ -3296,26 +3153,18 @@ describe("AcpAdapterV2", () => {
32963153 it.live("Grok reapplies an explicit return to the session's setup-time model", () =>
32973154 Effect.gen(function* () {
32983155 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3299 const fileSystem = yield* FileSystem.FileSystem;
3300 const idAllocator = yield* IdAllocator.IdAllocatorV2;
33013156 const path = yield* Path.Path;
3302 const host = yield* ProviderHost.ProviderHost;
33033157 const selfInvocation = yield* resolveSelfInvocation();
33043158 const mockAgentPath = yield* path.fromFileUrl(
33053159 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
33063160 );
33073161 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
33083162 const instanceId = ProviderInstanceId.make("grok-test-switch-back");
3309 const adapter = makeGrokAdapterV2({
3163 const adapter = yield* makeGrokAdapterV2({
33103164 instanceId,
33113165 settings: DEFAULT_GROK_SETTINGS,
33123166 environment: {},
33133167 hostPlatform: yield* HostProcessPlatform,
3314 childProcessSpawner,
3315 crypto: yield* Crypto.Crypto,
3316 fileSystem,
3317 idAllocator,
3318 host,
33193168 selfInvocation: yield* resolveSelfInvocation(),
33203169 // Production Grok runtimes are wrapped by the x.ai prompt runtime.
33213170 makeRuntime: (input) =>
......@@ -3377,26 +3226,19 @@ describe("AcpAdapterV2", () => {
33773226 it.effect("skips requested options that the active ACP session does not expose", () =>
33783227 Effect.gen(function* () {
33793228 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3380 const fileSystem = yield* FileSystem.FileSystem;
3381 const idAllocator = yield* IdAllocator.IdAllocatorV2;
33823229 const path = yield* Path.Path;
3383 const host = yield* ProviderHost.ProviderHost;
33843230 const selfInvocation = yield* resolveSelfInvocation();
33853231 const mockAgentPath = yield* path.fromFileUrl(
33863232 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
33873233 );
33883234 const instanceId = ProviderInstanceId.make("acp-test");
3389 const adapter = makeAcpAdapterV2({
3390 crypto: yield* Crypto.Crypto,
3235 const adapter = yield* makeAcpAdapterV2({
33913236 instanceId,
33923237 flavor: {
33933238 driver: ACP_TEST_DRIVER,
33943239 capabilities: AcpProviderCapabilitiesV2,
33953240 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),
33963241 },
3397 fileSystem,
3398 idAllocator,
3399 host,
34003242 selfInvocation,
34013243 });
34023244 const threadId = ThreadId.make("thread-acp-unsupported-option");
......@@ -3426,27 +3268,20 @@ describe("AcpAdapterV2", () => {
34263268 it.effect("reconfigures a loaded ACP session from its own active setup metadata", () =>
34273269 Effect.gen(function* () {
34283270 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3429 const fileSystem = yield* FileSystem.FileSystem;
3430 const idAllocator = yield* IdAllocator.IdAllocatorV2;
34313271 const path = yield* Path.Path;
3432 const host = yield* ProviderHost.ProviderHost;
34333272 const selfInvocation = yield* resolveSelfInvocation();
34343273 const mockAgentPath = yield* path.fromFileUrl(
34353274 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
34363275 );
34373276 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
34383277 const instanceId = ProviderInstanceId.make("acp-test");
3439 const adapter = makeAcpAdapterV2({
3440 crypto: yield* Crypto.Crypto,
3278 const adapter = yield* makeAcpAdapterV2({
34413279 instanceId,
34423280 flavor: {
34433281 driver: ACP_TEST_DRIVER,
34443282 capabilities: AcpProviderCapabilitiesV2,
34453283 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
34463284 },
3447 fileSystem,
3448 idAllocator,
3449 host,
34503285 selfInvocation,
34513286 });
34523287 const firstThreadId = ThreadId.make("thread-acp-active-setup:first");
......@@ -3537,18 +3372,15 @@ describe("AcpAdapterV2", () => {
35373372 it.live("terminalizes an empty successful foreground Bash tool when the turn completes", () =>
35383373 Effect.gen(function* () {
35393374 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3540 const fileSystem = yield* FileSystem.FileSystem;
35413375 const idAllocator = yield* IdAllocator.IdAllocatorV2;
35423376 const path = yield* Path.Path;
3543 const host = yield* ProviderHost.ProviderHost;
35443377 const selfInvocation = yield* resolveSelfInvocation();
35453378 const mockAgentPath = yield* path.fromFileUrl(
35463379 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
35473380 );
35483381 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
35493382 const instanceId = ProviderInstanceId.make("acp-test");
3550 const adapter = makeAcpAdapterV2({
3551 crypto: yield* Crypto.Crypto,
3383 const adapter = yield* makeAcpAdapterV2({
35523384 instanceId,
35533385 flavor: {
35543386 driver: ACP_TEST_DRIVER,
......@@ -3565,9 +3397,6 @@ describe("AcpAdapterV2", () => {
35653397 restartRuntimeAfterInterrupt: true,
35663398 terminateRuntimeProcessGroupOnInterrupt: true,
35673399 },
3568 fileSystem,
3569 idAllocator,
3570 host,
35713400 selfInvocation,
35723401 });
35733402 const threadId = ThreadId.make("thread-acp-empty-successful-bash");
......@@ -3684,16 +3513,12 @@ describe("AcpAdapterV2", () => {
36843513 it.effect("drains native ACP cancellation before admitting the next prompt", () =>
36853514 Effect.gen(function* () {
36863515 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3687 const fileSystem = yield* FileSystem.FileSystem;
3688 const idAllocator = yield* IdAllocator.IdAllocatorV2;
36893516 const path = yield* Path.Path;
3690 const host = yield* ProviderHost.ProviderHost;
36913517 const selfInvocation = yield* resolveSelfInvocation();
36923518 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
36933519 const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};
36943520 const instanceId = ProviderInstanceId.make("acp-native-cancel");
3695 const adapter = makeAcpAdapterV2({
3696 crypto: yield* Crypto.Crypto,
3521 const adapter = yield* makeAcpAdapterV2({
36973522 instanceId,
36983523 flavor: {
36993524 driver: ACP_TEST_DRIVER,
......@@ -3712,9 +3537,6 @@ describe("AcpAdapterV2", () => {
37123537 },
37133538 }),
37143539 },
3715 fileSystem,
3716 idAllocator,
3717 host,
37183540 selfInvocation,
37193541 });
37203542 const threadId = ThreadId.make("thread-acp-native-cancel");
......@@ -3798,18 +3620,14 @@ describe("AcpAdapterV2", () => {
37983620 it.effect("cancels pending permission requests while interrupting an ACP turn", () =>
37993621 Effect.gen(function* () {
38003622 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3801 const fileSystem = yield* FileSystem.FileSystem;
3802 const idAllocator = yield* IdAllocator.IdAllocatorV2;
38033623 const path = yield* Path.Path;
3804 const host = yield* ProviderHost.ProviderHost;
38053624 const selfInvocation = yield* resolveSelfInvocation();
38063625 const mockAgentPath = yield* path.fromFileUrl(
38073626 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
38083627 );
38093628 const releaseCancel = yield* Deferred.make<void>();
38103629 const instanceId = ProviderInstanceId.make("acp-test");
3811 const adapter = makeAcpAdapterV2({
3812 crypto: yield* Crypto.Crypto,
3630 const adapter = yield* makeAcpAdapterV2({
38133631 instanceId,
38143632 flavor: {
38153633 driver: ACP_TEST_DRIVER,
......@@ -3821,9 +3639,6 @@ describe("AcpAdapterV2", () => {
38213639 wrapCancel: (cancel) => Deferred.await(releaseCancel).pipe(Effect.andThen(cancel)),
38223640 }),
38233641 },
3824 fileSystem,
3825 idAllocator,
3826 host,
38273642 selfInvocation,
38283643 });
38293644 const threadId = ThreadId.make("thread-acp-cancel-permission");
......@@ -3899,10 +3714,7 @@ describe("AcpAdapterV2", () => {
38993714 it.live("keeps hard teardown excluded until a permission response is enqueued", () =>
39003715 Effect.gen(function* () {
39013716 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3902 const fileSystem = yield* FileSystem.FileSystem;
3903 const idAllocator = yield* IdAllocator.IdAllocatorV2;
39043717 const path = yield* Path.Path;
3905 const host = yield* ProviderHost.ProviderHost;
39063718 const selfInvocation = yield* resolveSelfInvocation();
39073719 const mockAgentPath = yield* path.fromFileUrl(
39083720 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -3910,8 +3722,7 @@ describe("AcpAdapterV2", () => {
39103722 const responseEnqueued = yield* Deferred.make<void>();
39113723 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
39123724 const instanceId = ProviderInstanceId.make("acp-test");
3913 const adapter = makeAcpAdapterV2({
3914 crypto: yield* Crypto.Crypto,
3725 const adapter = yield* makeAcpAdapterV2({
39153726 instanceId,
39163727 flavor: {
39173728 driver: ACP_TEST_DRIVER,
......@@ -3927,9 +3738,6 @@ describe("AcpAdapterV2", () => {
39273738 ),
39283739 }),
39293740 },
3930 fileSystem,
3931 idAllocator,
3932 host,
39333741 selfInvocation,
39343742 });
39353743 const threadId = ThreadId.make("thread-acp-response-wins-permission");
......@@ -3998,10 +3806,7 @@ describe("AcpAdapterV2", () => {
39983806 it.live("carries elicitation request identity through the completed stdout write", () =>
39993807 Effect.gen(function* () {
40003808 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4001 const fileSystem = yield* FileSystem.FileSystem;
4002 const idAllocator = yield* IdAllocator.IdAllocatorV2;
40033809 const path = yield* Path.Path;
4004 const host = yield* ProviderHost.ProviderHost;
40053810 const selfInvocation = yield* resolveSelfInvocation();
40063811 const mockAgentPath = yield* path.fromFileUrl(
40073812 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4009,8 +3814,7 @@ describe("AcpAdapterV2", () => {
40093814 const responseWritten = yield* Deferred.make<void>();
40103815 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
40113816 const instanceId = ProviderInstanceId.make("acp-test-reordered-elicitation");
4012 const adapter = makeAcpAdapterV2({
4013 crypto: yield* Crypto.Crypto,
3817 const adapter = yield* makeAcpAdapterV2({
40143818 instanceId,
40153819 flavor: {
40163820 driver: ACP_TEST_DRIVER,
......@@ -4026,9 +3830,6 @@ describe("AcpAdapterV2", () => {
40263830 ),
40273831 }),
40283832 },
4029 fileSystem,
4030 idAllocator,
4031 host,
40323833 selfInvocation,
40333834 });
40343835 const threadId = ThreadId.make("thread-acp-reordered-elicitation");
......@@ -4087,17 +3888,13 @@ describe("AcpAdapterV2", () => {
40873888 it.live("auto-approves tagged MCP elicitations under full-access policy", () =>
40883889 Effect.gen(function* () {
40893890 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4090 const fileSystem = yield* FileSystem.FileSystem;
4091 const idAllocator = yield* IdAllocator.IdAllocatorV2;
40923891 const path = yield* Path.Path;
4093 const host = yield* ProviderHost.ProviderHost;
40943892 const selfInvocation = yield* resolveSelfInvocation();
40953893 const mockAgentPath = yield* path.fromFileUrl(
40963894 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
40973895 );
40983896 const instanceId = ProviderInstanceId.make("acp-test-mcp-approval-elicitation");
4099 const adapter = makeAcpAdapterV2({
4100 crypto: yield* Crypto.Crypto,
3897 const adapter = yield* makeAcpAdapterV2({
41013898 instanceId,
41023899 flavor: {
41033900 driver: ACP_TEST_DRIVER,
......@@ -4108,9 +3905,6 @@ describe("AcpAdapterV2", () => {
41083905 environment: { T3_ACP_EMIT_MCP_TOOL_APPROVAL_ELICITATION: "1" },
41093906 }),
41103907 },
4111 fileSystem,
4112 idAllocator,
4113 host,
41143908 selfInvocation,
41153909 });
41163910 const threadId = ThreadId.make("thread-acp-mcp-approval-elicitation");
......@@ -4155,10 +3949,7 @@ describe("AcpAdapterV2", () => {
41553949 it.live("fails a held native response acknowledgement before normal session close", () =>
41563950 Effect.gen(function* () {
41573951 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4158 const fileSystem = yield* FileSystem.FileSystem;
4159 const idAllocator = yield* IdAllocator.IdAllocatorV2;
41603952 const path = yield* Path.Path;
4161 const host = yield* ProviderHost.ProviderHost;
41623953 const selfInvocation = yield* resolveSelfInvocation();
41633954 const mockAgentPath = yield* path.fromFileUrl(
41643955 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4167,8 +3958,7 @@ describe("AcpAdapterV2", () => {
41673958 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
41683959 const responseLifecycle: Array<string> = [];
41693960 const instanceId = ProviderInstanceId.make("acp-test-normal-close-held-response");
4170 const adapter = makeAcpAdapterV2({
4171 crypto: yield* Crypto.Crypto,
3961 const adapter = yield* makeAcpAdapterV2({
41723962 instanceId,
41733963 flavor: {
41743964 driver: ACP_TEST_DRIVER,
......@@ -4184,9 +3974,6 @@ describe("AcpAdapterV2", () => {
41843974 ),
41853975 }),
41863976 },
4187 fileSystem,
4188 idAllocator,
4189 host,
41903977 selfInvocation,
41913978 testHooks: {
41923979 onNativeResponseLifecycle: (event) =>
......@@ -4263,10 +4050,7 @@ describe("AcpAdapterV2", () => {
42634050 it.live("rejects delayed native response registration when normal close wins the permit", () =>
42644051 Effect.gen(function* () {
42654052 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4266 const fileSystem = yield* FileSystem.FileSystem;
4267 const idAllocator = yield* IdAllocator.IdAllocatorV2;
42684053 const path = yield* Path.Path;
4269 const host = yield* ProviderHost.ProviderHost;
42704054 const selfInvocation = yield* resolveSelfInvocation();
42714055 const mockAgentPath = yield* path.fromFileUrl(
42724056 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4277,8 +4061,7 @@ describe("AcpAdapterV2", () => {
42774061 const releaseTransportClose = yield* Deferred.make<void>();
42784062 const responseLifecycle: Array<string> = [];
42794063 const instanceId = ProviderInstanceId.make("acp-test-close-wins-registration");
4280 const adapter = makeAcpAdapterV2({
4281 crypto: yield* Crypto.Crypto,
4064 const adapter = yield* makeAcpAdapterV2({
42824065 instanceId,
42834066 flavor: {
42844067 driver: ACP_TEST_DRIVER,
......@@ -4289,9 +4072,6 @@ describe("AcpAdapterV2", () => {
42894072 environment: { T3_ACP_EMIT_TOOL_CALLS: "1" },
42904073 }),
42914074 },
4292 fileSystem,
4293 idAllocator,
4294 host,
42954075 selfInvocation,
42964076 testHooks: {
42974077 afterNativeResponseTransportClosed: () =>
......@@ -4377,10 +4157,7 @@ describe("AcpAdapterV2", () => {
43774157 it.live("bounds a missing pending permission response acknowledgement", () =>
43784158 Effect.gen(function* () {
43794159 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4380 const fileSystem = yield* FileSystem.FileSystem;
4381 const idAllocator = yield* IdAllocator.IdAllocatorV2;
43824160 const path = yield* Path.Path;
4383 const host = yield* ProviderHost.ProviderHost;
43844161 const selfInvocation = yield* resolveSelfInvocation();
43854162 const mockAgentPath = yield* path.fromFileUrl(
43864163 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4390,8 +4167,7 @@ describe("AcpAdapterV2", () => {
43904167 const responseLifecycle: Array<string> = [];
43914168 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
43924169 const instanceId = ProviderInstanceId.make("acp-test-pending-response-timeout");
4393 const adapter = makeAcpAdapterV2({
4394 crypto: yield* Crypto.Crypto,
4170 const adapter = yield* makeAcpAdapterV2({
43954171 instanceId,
43964172 flavor: {
43974173 driver: ACP_TEST_DRIVER,
......@@ -4423,9 +4199,6 @@ describe("AcpAdapterV2", () => {
44234199 ),
44244200 }),
44254201 },
4426 fileSystem,
4427 idAllocator,
4428 host,
44294202 selfInvocation,
44304203 testHooks: {
44314204 onNativeResponseLifecycle: (event) =>
......@@ -4518,10 +4291,7 @@ describe("AcpAdapterV2", () => {
45184291 it.live("defers caller cancellation until a pending response acknowledgement is bounded", () =>
45194292 Effect.gen(function* () {
45204293 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4521 const fileSystem = yield* FileSystem.FileSystem;
4522 const idAllocator = yield* IdAllocator.IdAllocatorV2;
45234294 const path = yield* Path.Path;
4524 const host = yield* ProviderHost.ProviderHost;
45254295 const selfInvocation = yield* resolveSelfInvocation();
45264296 const mockAgentPath = yield* path.fromFileUrl(
45274297 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4529,8 +4299,7 @@ describe("AcpAdapterV2", () => {
45294299 const responseEnqueued = yield* Deferred.make<void>();
45304300 const releaseNativeHook = yield* Deferred.make<void>();
45314301 const instanceId = ProviderInstanceId.make("acp-test-pending-response-cancel");
4532 const adapter = makeAcpAdapterV2({
4533 crypto: yield* Crypto.Crypto,
4302 const adapter = yield* makeAcpAdapterV2({
45344303 instanceId,
45354304 flavor: {
45364305 driver: ACP_TEST_DRIVER,
......@@ -4561,9 +4330,6 @@ describe("AcpAdapterV2", () => {
45614330 ),
45624331 }),
45634332 },
4564 fileSystem,
4565 idAllocator,
4566 host,
45674333 selfInvocation,
45684334 });
45694335 const threadId = ThreadId.make("thread-acp-pending-response-cancel");
......@@ -4634,10 +4400,8 @@ describe("AcpAdapterV2", () => {
46344400 it.live("waits for immediate allow and deny permission responses before hard teardown", () =>
46354401 Effect.gen(function* () {
46364402 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4637 const fileSystem = yield* FileSystem.FileSystem;
46384403 const idAllocator = yield* IdAllocator.IdAllocatorV2;
46394404 const path = yield* Path.Path;
4640 const host = yield* ProviderHost.ProviderHost;
46414405 const selfInvocation = yield* resolveSelfInvocation();
46424406 const mockAgentPath = yield* path.fromFileUrl(
46434407 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4651,8 +4415,7 @@ describe("AcpAdapterV2", () => {
46514415 const responseEnqueued = yield* Deferred.make<void>();
46524416 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
46534417 const instanceId = ProviderInstanceId.make(`acp-test-${name}`);
4654 const adapter = makeAcpAdapterV2({
4655 crypto: yield* Crypto.Crypto,
4418 const adapter = yield* makeAcpAdapterV2({
46564419 instanceId,
46574420 flavor: {
46584421 driver: ACP_TEST_DRIVER,
......@@ -4676,9 +4439,6 @@ describe("AcpAdapterV2", () => {
46764439 ),
46774440 }),
46784441 },
4679 fileSystem,
4680 idAllocator,
4681 host,
46824442 selfInvocation,
46834443 });
46844444 const threadId = ThreadId.make(`thread-acp-immediate-permission-${name}`);
......@@ -4739,10 +4499,8 @@ describe("AcpAdapterV2", () => {
47394499 it.live("waits for immediate URL elicitation responses before hard teardown", () =>
47404500 Effect.gen(function* () {
47414501 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4742 const fileSystem = yield* FileSystem.FileSystem;
47434502 const idAllocator = yield* IdAllocator.IdAllocatorV2;
47444503 const path = yield* Path.Path;
4745 const host = yield* ProviderHost.ProviderHost;
47464504 const selfInvocation = yield* resolveSelfInvocation();
47474505 const mockAgentPath = yield* path.fromFileUrl(
47484506 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4750,8 +4508,7 @@ describe("AcpAdapterV2", () => {
47504508 const responseEnqueued = yield* Deferred.make<void>();
47514509 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
47524510 const instanceId = ProviderInstanceId.make("acp-test-url-elicitation");
4753 const adapter = makeAcpAdapterV2({
4754 crypto: yield* Crypto.Crypto,
4511 const adapter = yield* makeAcpAdapterV2({
47554512 instanceId,
47564513 flavor: {
47574514 driver: ACP_TEST_DRIVER,
......@@ -4775,9 +4532,6 @@ describe("AcpAdapterV2", () => {
47754532 ),
47764533 }),
47774534 },
4778 fileSystem,
4779 idAllocator,
4780 host,
47814535 selfInvocation,
47824536 });
47834537 const threadId = ThreadId.make("thread-acp-immediate-url-elicitation");
......@@ -4832,10 +4586,8 @@ describe("AcpAdapterV2", () => {
48324586 it.live("bounds a missing immediate response acknowledgement before hard teardown", () =>
48334587 Effect.gen(function* () {
48344588 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4835 const fileSystem = yield* FileSystem.FileSystem;
48364589 const idAllocator = yield* IdAllocator.IdAllocatorV2;
48374590 const path = yield* Path.Path;
4838 const host = yield* ProviderHost.ProviderHost;
48394591 const selfInvocation = yield* resolveSelfInvocation();
48404592 const mockAgentPath = yield* path.fromFileUrl(
48414593 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4843,8 +4595,7 @@ describe("AcpAdapterV2", () => {
48434595 const responseEnqueued = yield* Deferred.make<void>();
48444596 const releaseNativeHook = yield* Deferred.make<void>();
48454597 const instanceId = ProviderInstanceId.make("acp-test-missing-response-ack");
4846 const adapter = makeAcpAdapterV2({
4847 crypto: yield* Crypto.Crypto,
4598 const adapter = yield* makeAcpAdapterV2({
48484599 instanceId,
48494600 flavor: {
48504601 driver: ACP_TEST_DRIVER,
......@@ -4872,9 +4623,6 @@ describe("AcpAdapterV2", () => {
48724623 ),
48734624 }),
48744625 },
4875 fileSystem,
4876 idAllocator,
4877 host,
48784626 selfInvocation,
48794627 });
48804628 const threadId = ThreadId.make("thread-acp-missing-response-ack");
......@@ -4925,10 +4673,7 @@ describe("AcpAdapterV2", () => {
49254673 it.live("rejects an elicitation response when hard teardown wins admission", () =>
49264674 Effect.gen(function* () {
49274675 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4928 const fileSystem = yield* FileSystem.FileSystem;
4929 const idAllocator = yield* IdAllocator.IdAllocatorV2;
49304676 const path = yield* Path.Path;
4931 const host = yield* ProviderHost.ProviderHost;
49324677 const selfInvocation = yield* resolveSelfInvocation();
49334678 const mockAgentPath = yield* path.fromFileUrl(
49344679 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -4936,8 +4681,7 @@ describe("AcpAdapterV2", () => {
49364681 const teardownStarted = yield* Deferred.make<void>();
49374682 const releaseTeardown = yield* Deferred.make<void>();
49384683 const instanceId = ProviderInstanceId.make("acp-test");
4939 const adapter = makeAcpAdapterV2({
4940 crypto: yield* Crypto.Crypto,
4684 const adapter = yield* makeAcpAdapterV2({
49414685 instanceId,
49424686 flavor: {
49434687 driver: ACP_TEST_DRIVER,
......@@ -4961,9 +4705,6 @@ describe("AcpAdapterV2", () => {
49614705 ),
49624706 }),
49634707 },
4964 fileSystem,
4965 idAllocator,
4966 host,
49674708 selfInvocation,
49684709 });
49694710 const threadId = ThreadId.make("thread-acp-teardown-wins-elicitation");
......@@ -5038,18 +4779,15 @@ describe("AcpAdapterV2", () => {
50384779 it.effect("releases an ACP turn when cancellation times out", () =>
50394780 Effect.gen(function* () {
50404781 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5041 const fileSystem = yield* FileSystem.FileSystem;
50424782 const idAllocator = yield* IdAllocator.IdAllocatorV2;
50434783 const path = yield* Path.Path;
5044 const host = yield* ProviderHost.ProviderHost;
50454784 const selfInvocation = yield* resolveSelfInvocation();
50464785 const mockAgentPath = yield* path.fromFileUrl(
50474786 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
50484787 );
50494788 const instanceId = ProviderInstanceId.make("acp-test");
50504789 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5051 const adapter = makeAcpAdapterV2({
5052 crypto: yield* Crypto.Crypto,
4790 const adapter = yield* makeAcpAdapterV2({
50534791 instanceId,
50544792 flavor: {
50554793 driver: ACP_TEST_DRIVER,
......@@ -5061,9 +4799,6 @@ describe("AcpAdapterV2", () => {
50614799 protocolEvents,
50624800 }),
50634801 },
5064 fileSystem,
5065 idAllocator,
5066 host,
50674802 selfInvocation,
50684803 });
50694804 const threadId = ThreadId.make("thread-acp-cancel-timeout");
......@@ -5141,18 +4876,15 @@ describe("AcpAdapterV2", () => {
51414876 it.live("treats a second hard Stop as success when the turn is already gone", () =>
51424877 Effect.gen(function* () {
51434878 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5144 const fileSystem = yield* FileSystem.FileSystem;
51454879 const idAllocator = yield* IdAllocator.IdAllocatorV2;
51464880 const path = yield* Path.Path;
5147 const host = yield* ProviderHost.ProviderHost;
51484881 const selfInvocation = yield* resolveSelfInvocation();
51494882 const mockAgentPath = yield* path.fromFileUrl(
51504883 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
51514884 );
51524885 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
51534886 const instanceId = ProviderInstanceId.make("acp-test");
5154 const adapter = makeAcpAdapterV2({
5155 crypto: yield* Crypto.Crypto,
4887 const adapter = yield* makeAcpAdapterV2({
51564888 instanceId,
51574889 flavor: {
51584890 driver: ACP_TEST_DRIVER,
......@@ -5168,9 +4900,6 @@ describe("AcpAdapterV2", () => {
51684900 protocolEvents,
51694901 }),
51704902 },
5171 fileSystem,
5172 idAllocator,
5173 host,
51744903 selfInvocation,
51754904 });
51764905 const threadId = ThreadId.make("thread-acp-double-stop");
......@@ -5239,22 +4968,19 @@ describe("AcpAdapterV2", () => {
52394968 it.effect("finalizes a settled turn held open for background work when interrupted", () =>
52404969 Effect.gen(function* () {
52414970 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5242 const fileSystem = yield* FileSystem.FileSystem;
52434971 const idAllocator = yield* IdAllocator.IdAllocatorV2;
52444972 const path = yield* Path.Path;
5245 const host = yield* ProviderHost.ProviderHost;
52464973 const selfInvocation = yield* resolveSelfInvocation();
52474974 const mockAgentPath = yield* path.fromFileUrl(
52484975 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
52494976 );
52504977 const instanceId = ProviderInstanceId.make("acp-test");
52514978 const promptSettled = yield* Deferred.make<void>();
5252 const adapter = makeAcpAdapterV2({
4979 const adapter = yield* makeAcpAdapterV2({
52534980 testHooks: {
52544981 afterPromptSettledWithBackgroundWork: () =>
52554982 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
52564983 },
5257 crypto: yield* Crypto.Crypto,
52584984 instanceId,
52594985 flavor: {
52604986 driver: ACP_TEST_DRIVER,
......@@ -5278,9 +5004,6 @@ describe("AcpAdapterV2", () => {
52785004 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
52795005 }),
52805006 },
5281 fileSystem,
5282 idAllocator,
5283 host,
52845007 selfInvocation,
52855008 });
52865009 const threadId = ThreadId.make("thread-acp-interrupt-background-hold");
......@@ -5335,10 +5058,8 @@ describe("AcpAdapterV2", () => {
53355058 () =>
53365059 Effect.gen(function* () {
53375060 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5338 const fileSystem = yield* FileSystem.FileSystem;
53395061 const idAllocator = yield* IdAllocator.IdAllocatorV2;
53405062 const path = yield* Path.Path;
5341 const host = yield* ProviderHost.ProviderHost;
53425063 const selfInvocation = yield* resolveSelfInvocation();
53435064 const mockAgentPath = yield* path.fromFileUrl(
53445065 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -5346,12 +5067,11 @@ describe("AcpAdapterV2", () => {
53465067 const instanceId = ProviderInstanceId.make("acp-test");
53475068 let subagentPhase: "spawn" | "complete" = "spawn";
53485069 const promptSettled = yield* Deferred.make<void>();
5349 const adapter = makeAcpAdapterV2({
5070 const adapter = yield* makeAcpAdapterV2({
53505071 testHooks: {
53515072 afterPromptSettledWithBackgroundWork: () =>
53525073 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
53535074 },
5354 crypto: yield* Crypto.Crypto,
53555075 instanceId,
53565076 flavor: {
53575077 driver: ACP_TEST_DRIVER,
......@@ -5388,9 +5108,6 @@ describe("AcpAdapterV2", () => {
53885108 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
53895109 }),
53905110 },
5391 fileSystem,
5392 idAllocator,
5393 host,
53945111 selfInvocation,
53955112 });
53965113 const threadId = ThreadId.make("thread-acp-subagent-carryover");
......@@ -5483,10 +5200,8 @@ describe("AcpAdapterV2", () => {
54835200 () =>
54845201 Effect.gen(function* () {
54855202 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5486 const fileSystem = yield* FileSystem.FileSystem;
54875203 const idAllocator = yield* IdAllocator.IdAllocatorV2;
54885204 const path = yield* Path.Path;
5489 const host = yield* ProviderHost.ProviderHost;
54905205 const selfInvocation = yield* resolveSelfInvocation();
54915206 const mockAgentPath = yield* path.fromFileUrl(
54925207 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -5494,12 +5209,11 @@ describe("AcpAdapterV2", () => {
54945209 const instanceId = ProviderInstanceId.make("acp-test");
54955210 let subagentPhase: "spawn" | "complete" = "spawn";
54965211 const promptSettled = yield* Deferred.make<void>();
5497 const adapter = makeAcpAdapterV2({
5212 const adapter = yield* makeAcpAdapterV2({
54985213 testHooks: {
54995214 afterPromptSettledWithBackgroundWork: () =>
55005215 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
55015216 },
5502 crypto: yield* Crypto.Crypto,
55035217 instanceId,
55045218 flavor: {
55055219 driver: ACP_TEST_DRIVER,
......@@ -5534,9 +5248,6 @@ describe("AcpAdapterV2", () => {
55345248 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
55355249 }),
55365250 },
5537 fileSystem,
5538 idAllocator,
5539 host,
55405251 selfInvocation,
55415252 continuationRequests: { offer: () => Effect.void },
55425253 });
......@@ -5630,10 +5341,8 @@ describe("AcpAdapterV2", () => {
56305341 it.effect("handles a child terminal after carryover rehydrate", () =>
56315342 Effect.gen(function* () {
56325343 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5633 const fileSystem = yield* FileSystem.FileSystem;
56345344 const idAllocator = yield* IdAllocator.IdAllocatorV2;
56355345 const path = yield* Path.Path;
5636 const host = yield* ProviderHost.ProviderHost;
56375346 const selfInvocation = yield* resolveSelfInvocation();
56385347 const mockAgentPath = yield* path.fromFileUrl(
56395348 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -5647,12 +5356,11 @@ describe("AcpAdapterV2", () => {
56475356 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
56485357 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
56495358 const promptSettled = yield* Deferred.make<void>();
5650 const adapter = makeAcpAdapterV2({
5359 const adapter = yield* makeAcpAdapterV2({
56515360 testHooks: {
56525361 afterPromptSettledWithBackgroundWork: () =>
56535362 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
56545363 },
5655 crypto: yield* Crypto.Crypto,
56565364 instanceId,
56575365 flavor: {
56585366 driver: ACP_TEST_DRIVER,
......@@ -5704,9 +5412,6 @@ describe("AcpAdapterV2", () => {
57045412 }),
57055413 }),
57065414 },
5707 fileSystem,
5708 idAllocator,
5709 host,
57105415 selfInvocation,
57115416 continuationRequests: { offer: () => Effect.void },
57125417 });
......@@ -5867,10 +5572,8 @@ describe("AcpAdapterV2", () => {
58675572 () =>
58685573 Effect.gen(function* () {
58695574 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5870 const fileSystem = yield* FileSystem.FileSystem;
58715575 const idAllocator = yield* IdAllocator.IdAllocatorV2;
58725576 const path = yield* Path.Path;
5873 const host = yield* ProviderHost.ProviderHost;
58745577 const selfInvocation = yield* resolveSelfInvocation();
58755578 const mockAgentPath = yield* path.fromFileUrl(
58765579 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -5903,12 +5606,11 @@ describe("AcpAdapterV2", () => {
59035606 | Parameters<RuntimeService["handleSessionUpdate"]>[0]
59045607 | undefined;
59055608 const promptSettled = yield* Deferred.make<void>();
5906 const adapter = makeAcpAdapterV2({
5609 const adapter = yield* makeAcpAdapterV2({
59075610 testHooks: {
59085611 afterPromptSettledWithBackgroundWork: () =>
59095612 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
59105613 },
5911 crypto: yield* Crypto.Crypto,
59125614 instanceId,
59135615 flavor: {
59145616 driver: ACP_TEST_DRIVER,
......@@ -5955,9 +5657,6 @@ describe("AcpAdapterV2", () => {
59555657 }),
59565658 }),
59575659 },
5958 fileSystem,
5959 idAllocator,
5960 host,
59615660 selfInvocation,
59625661 continuationRequests: { offer: () => Effect.void },
59635662 });
......@@ -6090,10 +5789,8 @@ describe("AcpAdapterV2", () => {
60905789 () =>
60915790 Effect.gen(function* () {
60925791 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6093 const fileSystem = yield* FileSystem.FileSystem;
60945792 const idAllocator = yield* IdAllocator.IdAllocatorV2;
60955793 const path = yield* Path.Path;
6096 const host = yield* ProviderHost.ProviderHost;
60975794 const selfInvocation = yield* resolveSelfInvocation();
60985795 const mockAgentPath = yield* path.fromFileUrl(
60995796 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -6106,12 +5803,11 @@ describe("AcpAdapterV2", () => {
61065803 let subagentPhase: "spawn" | "complete" = "spawn";
61075804 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
61085805 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
6109 const adapter = makeAcpAdapterV2({
5806 const adapter = yield* makeAcpAdapterV2({
61105807 testHooks: {
61115808 afterPromptSettledWithBackgroundWork: () =>
61125809 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
61135810 },
6114 crypto: yield* Crypto.Crypto,
61155811 instanceId,
61165812 flavor: {
61175813 driver: ACP_TEST_DRIVER,
......@@ -6154,9 +5850,6 @@ describe("AcpAdapterV2", () => {
61545850 }),
61555851 }),
61565852 },
6157 fileSystem,
6158 idAllocator,
6159 host,
61605853 selfInvocation,
61615854 continuationRequests: {
61625855 offer: (request) =>
......@@ -6309,10 +6002,8 @@ describe("AcpAdapterV2", () => {
63096002 it.effect("finishes a settled root's carryover subagent from its structured end", () =>
63106003 Effect.gen(function* () {
63116004 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6312 const fileSystem = yield* FileSystem.FileSystem;
63136005 const idAllocator = yield* IdAllocator.IdAllocatorV2;
63146006 const path = yield* Path.Path;
6315 const host = yield* ProviderHost.ProviderHost;
63166007 const selfInvocation = yield* resolveSelfInvocation();
63176008 const mockAgentPath = yield* path.fromFileUrl(
63186009 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -6321,8 +6012,7 @@ describe("AcpAdapterV2", () => {
63216012 const instanceId = ProviderInstanceId.make("acp-test");
63226013 const childSessionId = "019f44a6-4820-7402-925d-bc862ee711dd";
63236014 let finishSubagent: AcpAdapterV2ExtensionContext["finishSubagent"] | undefined;
6324 const adapter = makeAcpAdapterV2({
6325 crypto: yield* Crypto.Crypto,
6015 const adapter = yield* makeAcpAdapterV2({
63266016 instanceId,
63276017 flavor: {
63286018 driver: ACP_TEST_DRIVER,
......@@ -6352,9 +6042,6 @@ describe("AcpAdapterV2", () => {
63526042 protocolEvents,
63536043 }),
63546044 },
6355 fileSystem,
6356 idAllocator,
6357 host,
63586045 selfInvocation,
63596046 continuationRequests: { offer: () => Effect.void },
63606047 });
......@@ -6457,10 +6144,8 @@ describe("AcpAdapterV2", () => {
64576144 it.effect("projects completed-root carryover eagerly and drain cannot resurrect it", () =>
64586145 Effect.gen(function* () {
64596146 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6460 const fileSystem = yield* FileSystem.FileSystem;
64616147 const idAllocator = yield* IdAllocator.IdAllocatorV2;
64626148 const path = yield* Path.Path;
6463 const host = yield* ProviderHost.ProviderHost;
64646149 const selfInvocation = yield* resolveSelfInvocation();
64656150 const mockAgentPath = yield* path.fromFileUrl(
64666151 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -6472,8 +6157,7 @@ describe("AcpAdapterV2", () => {
64726157 let subagentPhase: "spawn" | "complete" = "spawn";
64736158 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
64746159 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
6475 const adapter = makeAcpAdapterV2({
6476 crypto: yield* Crypto.Crypto,
6160 const adapter = yield* makeAcpAdapterV2({
64776161 instanceId,
64786162 flavor: {
64796163 driver: ACP_TEST_DRIVER,
......@@ -6517,9 +6201,6 @@ describe("AcpAdapterV2", () => {
65176201 }),
65186202 }),
65196203 },
6520 fileSystem,
6521 idAllocator,
6522 host,
65236204 selfInvocation,
65246205 continuationRequests: {
65256206 offer: (request) =>
......@@ -6709,10 +6390,8 @@ describe("AcpAdapterV2", () => {
67096390 () =>
67106391 Effect.gen(function* () {
67116392 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6712 const fileSystem = yield* FileSystem.FileSystem;
67136393 const idAllocator = yield* IdAllocator.IdAllocatorV2;
67146394 const path = yield* Path.Path;
6715 const host = yield* ProviderHost.ProviderHost;
67166395 const selfInvocation = yield* resolveSelfInvocation();
67176396 const mockAgentPath = yield* path.fromFileUrl(
67186397 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -6724,12 +6403,11 @@ describe("AcpAdapterV2", () => {
67246403 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
67256404 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
67266405 const promptSettled = yield* Deferred.make<void>();
6727 const adapter = makeAcpAdapterV2({
6406 const adapter = yield* makeAcpAdapterV2({
67286407 testHooks: {
67296408 afterPromptSettledWithBackgroundWork: () =>
67306409 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
67316410 },
6732 crypto: yield* Crypto.Crypto,
67336411 instanceId,
67346412 flavor: {
67356413 driver: ACP_TEST_DRIVER,
......@@ -6771,9 +6449,6 @@ describe("AcpAdapterV2", () => {
67716449 }),
67726450 }),
67736451 },
6774 fileSystem,
6775 idAllocator,
6776 host,
67776452 selfInvocation,
67786453 continuationRequests: {
67796454 offer: (request) =>
......@@ -6997,10 +6672,8 @@ describe("AcpAdapterV2", () => {
69976672 () =>
69986673 Effect.gen(function* () {
69996674 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7000 const fileSystem = yield* FileSystem.FileSystem;
70016675 const idAllocator = yield* IdAllocator.IdAllocatorV2;
70026676 const path = yield* Path.Path;
7003 const host = yield* ProviderHost.ProviderHost;
70046677 const selfInvocation = yield* resolveSelfInvocation();
70056678 const mockAgentPath = yield* path.fromFileUrl(
70066679 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -7013,12 +6686,11 @@ describe("AcpAdapterV2", () => {
70136686 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
70146687 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
70156688 const promptSettled = yield* Deferred.make<void>();
7016 const adapter = makeAcpAdapterV2({
6689 const adapter = yield* makeAcpAdapterV2({
70176690 testHooks: {
70186691 afterPromptSettledWithBackgroundWork: () =>
70196692 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
70206693 },
7021 crypto: yield* Crypto.Crypto,
70226694 instanceId,
70236695 flavor: {
70246696 driver: ACP_TEST_DRIVER,
......@@ -7069,9 +6741,6 @@ describe("AcpAdapterV2", () => {
70696741 }),
70706742 }),
70716743 },
7072 fileSystem,
7073 idAllocator,
7074 host,
70756744 selfInvocation,
70766745 continuationRequests: {
70776746 offer: (request) =>
......@@ -7238,10 +6907,8 @@ describe("AcpAdapterV2", () => {
72386907 it.effect("projects an interrupted root-session end notice at the next attach", () =>
72396908 Effect.gen(function* () {
72406909 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7241 const fileSystem = yield* FileSystem.FileSystem;
72426910 const idAllocator = yield* IdAllocator.IdAllocatorV2;
72436911 const path = yield* Path.Path;
7244 const host = yield* ProviderHost.ProviderHost;
72456912 const selfInvocation = yield* resolveSelfInvocation();
72466913 const mockAgentPath = yield* path.fromFileUrl(
72476914 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -7254,12 +6921,11 @@ describe("AcpAdapterV2", () => {
72546921 let subagentPhase: "spawn" | "complete" = "spawn";
72556922 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
72566923 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
7257 const adapter = makeAcpAdapterV2({
6924 const adapter = yield* makeAcpAdapterV2({
72586925 testHooks: {
72596926 afterPromptSettledWithBackgroundWork: () =>
72606927 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
72616928 },
7262 crypto: yield* Crypto.Crypto,
72636929 instanceId,
72646930 flavor: {
72656931 driver: ACP_TEST_DRIVER,
......@@ -7313,9 +6979,6 @@ describe("AcpAdapterV2", () => {
73136979 }),
73146980 }),
73156981 },
7316 fileSystem,
7317 idAllocator,
7318 host,
73196982 selfInvocation,
73206983 continuationRequests: {
73216984 offer: (request) =>
......@@ -7467,10 +7130,8 @@ describe("AcpAdapterV2", () => {
74677130 () =>
74687131 Effect.gen(function* () {
74697132 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7470 const fileSystem = yield* FileSystem.FileSystem;
74717133 const idAllocator = yield* IdAllocator.IdAllocatorV2;
74727134 const path = yield* Path.Path;
7473 const host = yield* ProviderHost.ProviderHost;
74747135 const selfInvocation = yield* resolveSelfInvocation();
74757136 const mockAgentPath = yield* path.fromFileUrl(
74767137 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -7483,12 +7144,11 @@ describe("AcpAdapterV2", () => {
74837144 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
74847145 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
74857146 const promptSettled = yield* Deferred.make<void>();
7486 const adapter = makeAcpAdapterV2({
7147 const adapter = yield* makeAcpAdapterV2({
74877148 testHooks: {
74887149 afterPromptSettledWithBackgroundWork: () =>
74897150 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
74907151 },
7491 crypto: yield* Crypto.Crypto,
74927152 instanceId,
74937153 flavor: {
74947154 driver: ACP_TEST_DRIVER,
......@@ -7530,9 +7190,6 @@ describe("AcpAdapterV2", () => {
75307190 }),
75317191 }),
75327192 },
7533 fileSystem,
7534 idAllocator,
7535 host,
75367193 selfInvocation,
75377194 continuationRequests: {
75387195 offer: (request) =>
......@@ -7738,10 +7395,8 @@ describe("AcpAdapterV2", () => {
77387395 () =>
77397396 Effect.gen(function* () {
77407397 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7741 const fileSystem = yield* FileSystem.FileSystem;
77427398 const idAllocator = yield* IdAllocator.IdAllocatorV2;
77437399 const path = yield* Path.Path;
7744 const host = yield* ProviderHost.ProviderHost;
77457400 const selfInvocation = yield* resolveSelfInvocation();
77467401 const mockAgentPath = yield* path.fromFileUrl(
77477402 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -7753,12 +7408,11 @@ describe("AcpAdapterV2", () => {
77537408 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
77547409 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
77557410 const promptSettled = yield* Deferred.make<void>();
7756 const adapter = makeAcpAdapterV2({
7411 const adapter = yield* makeAcpAdapterV2({
77577412 testHooks: {
77587413 afterPromptSettledWithBackgroundWork: () =>
77597414 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
77607415 },
7761 crypto: yield* Crypto.Crypto,
77627416 instanceId,
77637417 flavor: {
77647418 driver: ACP_TEST_DRIVER,
......@@ -7800,9 +7454,6 @@ describe("AcpAdapterV2", () => {
78007454 }),
78017455 }),
78027456 },
7803 fileSystem,
7804 idAllocator,
7805 host,
78067457 selfInvocation,
78077458 continuationRequests: {
78087459 offer: (request) =>
......@@ -7980,10 +7631,8 @@ describe("AcpAdapterV2", () => {
79807631 () =>
79817632 Effect.gen(function* () {
79827633 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7983 const fileSystem = yield* FileSystem.FileSystem;
79847634 const idAllocator = yield* IdAllocator.IdAllocatorV2;
79857635 const path = yield* Path.Path;
7986 const host = yield* ProviderHost.ProviderHost;
79877636 const selfInvocation = yield* resolveSelfInvocation();
79887637 const mockAgentPath = yield* path.fromFileUrl(
79897638 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -7993,12 +7642,11 @@ describe("AcpAdapterV2", () => {
79937642 let cancelCalled = false;
79947643 let runtimeOrdinalSeen = 0;
79957644 const promptSettled = yield* Deferred.make<void>();
7996 const adapter = makeAcpAdapterV2({
7645 const adapter = yield* makeAcpAdapterV2({
79977646 testHooks: {
79987647 afterPromptSettledWithBackgroundWork: () =>
79997648 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
80007649 },
8001 crypto: yield* Crypto.Crypto,
80027650 instanceId,
80037651 flavor: {
80047652 driver: ACP_TEST_DRIVER,
......@@ -8050,9 +7698,6 @@ describe("AcpAdapterV2", () => {
80507698 }).pipe(Effect.andThen(cancel)),
80517699 }),
80527700 },
8053 fileSystem,
8054 idAllocator,
8055 host,
80567701 selfInvocation,
80577702 });
80587703 const threadId = ThreadId.make("thread-acp-settled-soft-steer");
......@@ -8156,18 +7801,15 @@ describe("AcpAdapterV2", () => {
81567801 it.live("preserveRuntimeOnSettledInterrupt does not soften a mid-prompt steering interrupt", () =>
81577802 Effect.gen(function* () {
81587803 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8159 const fileSystem = yield* FileSystem.FileSystem;
81607804 const idAllocator = yield* IdAllocator.IdAllocatorV2;
81617805 const path = yield* Path.Path;
8162 const host = yield* ProviderHost.ProviderHost;
81637806 const selfInvocation = yield* resolveSelfInvocation();
81647807 const mockAgentPath = yield* path.fromFileUrl(
81657808 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
81667809 );
81677810 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
81687811 const instanceId = ProviderInstanceId.make("acp-test");
8169 const adapter = makeAcpAdapterV2({
8170 crypto: yield* Crypto.Crypto,
7812 const adapter = yield* makeAcpAdapterV2({
81717813 instanceId,
81727814 flavor: {
81737815 driver: ACP_TEST_DRIVER,
......@@ -8189,9 +7831,6 @@ describe("AcpAdapterV2", () => {
81897831 protocolEvents,
81907832 }),
81917833 },
8192 fileSystem,
8193 idAllocator,
8194 host,
81957834 selfInvocation,
81967835 });
81977836 const threadId = ThreadId.make("thread-acp-unsettled-steer-stays-hard");
......@@ -8246,10 +7885,8 @@ describe("AcpAdapterV2", () => {
82467885 () =>
82477886 Effect.gen(function* () {
82487887 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8249 const fileSystem = yield* FileSystem.FileSystem;
82507888 const idAllocator = yield* IdAllocator.IdAllocatorV2;
82517889 const path = yield* Path.Path;
8252 const host = yield* ProviderHost.ProviderHost;
82537890 const selfInvocation = yield* resolveSelfInvocation();
82547891 const mockAgentPath = yield* path.fromFileUrl(
82557892 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -8259,8 +7896,7 @@ describe("AcpAdapterV2", () => {
82597896 const instanceId = ProviderInstanceId.make("acp-test");
82607897 let cancelCalled = false;
82617898 let runtimeOrdinalSeen = 0;
8262 const adapter = makeAcpAdapterV2({
8263 crypto: yield* Crypto.Crypto,
7899 const adapter = yield* makeAcpAdapterV2({
82647900 instanceId,
82657901 flavor: {
82667902 driver: ACP_TEST_DRIVER,
......@@ -8295,9 +7931,6 @@ describe("AcpAdapterV2", () => {
82957931 }).pipe(Effect.andThen(cancel)),
82967932 }),
82977933 },
8298 fileSystem,
8299 idAllocator,
8300 host,
83017934 selfInvocation,
83027935 continuationRequests: {
83037936 offer: (request) =>
......@@ -8440,10 +8073,8 @@ describe("AcpAdapterV2", () => {
84408073 it.live("direct Stop quarantine drops late background task mutations from the stopped run", () =>
84418074 Effect.gen(function* () {
84428075 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8443 const fileSystem = yield* FileSystem.FileSystem;
84448076 const idAllocator = yield* IdAllocator.IdAllocatorV2;
84458077 const path = yield* Path.Path;
8446 const host = yield* ProviderHost.ProviderHost;
84478078 const selfInvocation = yield* resolveSelfInvocation();
84488079 const mockAgentPath = yield* path.fromFileUrl(
84498080 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -8459,8 +8090,7 @@ describe("AcpAdapterV2", () => {
84598090 }) => Effect.Effect<void>)
84608091 | null;
84618092 } = { current: null };
8462 const adapter = makeAcpAdapterV2({
8463 crypto: yield* Crypto.Crypto,
8093 const adapter = yield* makeAcpAdapterV2({
84648094 instanceId,
84658095 flavor: {
84668096 driver: ACP_TEST_DRIVER,
......@@ -8481,9 +8111,6 @@ describe("AcpAdapterV2", () => {
84818111 protocolEvents,
84828112 }),
84838113 },
8484 fileSystem,
8485 idAllocator,
8486 host,
84878114 selfInvocation,
84888115 continuationRequests: { offer: () => Effect.void },
84898116 });
......@@ -8587,10 +8214,8 @@ describe("AcpAdapterV2", () => {
85878214 it.live("production Grok interrupt flags still hard-kill and respawn on user Stop", () =>
85888215 Effect.gen(function* () {
85898216 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8590 const fileSystem = yield* FileSystem.FileSystem;
85918217 const idAllocator = yield* IdAllocator.IdAllocatorV2;
85928218 const path = yield* Path.Path;
8593 const host = yield* ProviderHost.ProviderHost;
85948219 const selfInvocation = yield* resolveSelfInvocation();
85958220 const mockAgentPath = yield* path.fromFileUrl(
85968221 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -8598,8 +8223,7 @@ describe("AcpAdapterV2", () => {
85988223 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
85998224 const instanceId = ProviderInstanceId.make("acp-test");
86008225 let runtimeOrdinalSeen = 0;
8601 const adapter = makeAcpAdapterV2({
8602 crypto: yield* Crypto.Crypto,
8226 const adapter = yield* makeAcpAdapterV2({
86038227 instanceId,
86048228 flavor: {
86058229 driver: ACP_TEST_DRIVER,
......@@ -8627,9 +8251,6 @@ describe("AcpAdapterV2", () => {
86278251 protocolEvents,
86288252 }),
86298253 },
8630 fileSystem,
8631 idAllocator,
8632 host,
86338254 selfInvocation,
86348255 continuationRequests: { offer: () => Effect.void },
86358256 });
......@@ -8718,10 +8339,8 @@ describe("AcpAdapterV2", () => {
87188339 () =>
87198340 Effect.gen(function* () {
87208341 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8721 const fileSystem = yield* FileSystem.FileSystem;
87228342 const idAllocator = yield* IdAllocator.IdAllocatorV2;
87238343 const path = yield* Path.Path;
8724 const host = yield* ProviderHost.ProviderHost;
87258344 const selfInvocation = yield* resolveSelfInvocation();
87268345 const mockAgentPath = yield* path.fromFileUrl(
87278346 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -8736,12 +8355,11 @@ describe("AcpAdapterV2", () => {
87368355 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
87378356 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
87388357 const promptSettled = yield* Deferred.make<void>();
8739 const adapter = makeAcpAdapterV2({
8358 const adapter = yield* makeAcpAdapterV2({
87408359 testHooks: {
87418360 afterPromptSettledWithBackgroundWork: () =>
87428361 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
87438362 },
8744 crypto: yield* Crypto.Crypto,
87458363 instanceId,
87468364 flavor: {
87478365 driver: ACP_TEST_DRIVER,
......@@ -8796,9 +8414,6 @@ describe("AcpAdapterV2", () => {
87968414 }),
87978415 }),
87988416 },
8799 fileSystem,
8800 idAllocator,
8801 host,
88028417 selfInvocation,
88038418 });
88048419 const threadId = ThreadId.make("thread-acp-stop-after-soft-steer-orphan");
......@@ -9022,10 +8637,8 @@ describe("AcpAdapterV2", () => {
90228637 it.live("Direct Stop projects an interrupt-deferred terminal exactly once", () =>
90238638 Effect.gen(function* () {
90248639 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9025 const fileSystem = yield* FileSystem.FileSystem;
90268640 const idAllocator = yield* IdAllocator.IdAllocatorV2;
90278641 const path = yield* Path.Path;
9028 const host = yield* ProviderHost.ProviderHost;
90298642 const selfInvocation = yield* resolveSelfInvocation();
90308643 const mockAgentPath = yield* path.fromFileUrl(
90318644 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9036,8 +8649,7 @@ describe("AcpAdapterV2", () => {
90368649 let subagentPhase: "spawn" | "complete" = "spawn";
90378650 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
90388651 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
9039 const adapter = makeAcpAdapterV2({
9040 crypto: yield* Crypto.Crypto,
8652 const adapter = yield* makeAcpAdapterV2({
90418653 instanceId,
90428654 flavor: {
90438655 driver: ACP_TEST_DRIVER,
......@@ -9084,9 +8696,6 @@ describe("AcpAdapterV2", () => {
90848696 }),
90858697 }),
90868698 },
9087 fileSystem,
9088 idAllocator,
9089 host,
90908699 selfInvocation,
90918700 continuationRequests: { offer: () => Effect.void },
90928701 });
......@@ -9219,10 +8828,8 @@ describe("AcpAdapterV2", () => {
92198828 () =>
92208829 Effect.gen(function* () {
92218830 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9222 const fileSystem = yield* FileSystem.FileSystem;
92238831 const idAllocator = yield* IdAllocator.IdAllocatorV2;
92248832 const path = yield* Path.Path;
9225 const host = yield* ProviderHost.ProviderHost;
92268833 const selfInvocation = yield* resolveSelfInvocation();
92278834 const mockAgentPath = yield* path.fromFileUrl(
92288835 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9238,8 +8845,7 @@ describe("AcpAdapterV2", () => {
92388845 // interrupt then ORs wire-done with promptSettled under the permit.
92398846 const promptWireReturned = yield* Deferred.make<void>();
92408847 const releasePromptCompletion = yield* Deferred.make<void>();
9241 const adapter = makeAcpAdapterV2({
9242 crypto: yield* Crypto.Crypto,
8848 const adapter = yield* makeAcpAdapterV2({
92438849 instanceId,
92448850 flavor: {
92458851 driver: ACP_TEST_DRIVER,
......@@ -9295,9 +8901,6 @@ describe("AcpAdapterV2", () => {
92958901 }),
92968902 }),
92978903 },
9298 fileSystem,
9299 idAllocator,
9300 host,
93018904 selfInvocation,
93028905 });
93038906 const threadId = ThreadId.make("thread-acp-settled-soft-admission-race");
......@@ -9389,10 +8992,8 @@ describe("AcpAdapterV2", () => {
93898992 () =>
93908993 Effect.gen(function* () {
93918994 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9392 const fileSystem = yield* FileSystem.FileSystem;
93938995 const idAllocator = yield* IdAllocator.IdAllocatorV2;
93948996 const path = yield* Path.Path;
9395 const host = yield* ProviderHost.ProviderHost;
93968997 const selfInvocation = yield* resolveSelfInvocation();
93978998 const mockAgentPath = yield* path.fromFileUrl(
93988999 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9400,8 +9001,7 @@ describe("AcpAdapterV2", () => {
94009001 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
94019002 const continuationRequests: Array<ProviderContinuationRequest> = [];
94029003 const instanceId = ProviderInstanceId.make("acp-test");
9403 const adapter = makeAcpAdapterV2({
9404 crypto: yield* Crypto.Crypto,
9004 const adapter = yield* makeAcpAdapterV2({
94059005 instanceId,
94069006 flavor: {
94079007 driver: ACP_TEST_DRIVER,
......@@ -9428,9 +9028,6 @@ describe("AcpAdapterV2", () => {
94289028 protocolEvents,
94299029 }),
94309030 },
9431 fileSystem,
9432 idAllocator,
9433 host,
94349031 selfInvocation,
94359032 continuationRequests: {
94369033 offer: (request) =>
......@@ -9520,10 +9117,8 @@ describe("AcpAdapterV2", () => {
95209117 () =>
95219118 Effect.gen(function* () {
95229119 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9523 const fileSystem = yield* FileSystem.FileSystem;
95249120 const idAllocator = yield* IdAllocator.IdAllocatorV2;
95259121 const path = yield* Path.Path;
9526 const host = yield* ProviderHost.ProviderHost;
95279122 const selfInvocation = yield* resolveSelfInvocation();
95289123 const mockAgentPath = yield* path.fromFileUrl(
95299124 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9532,8 +9127,7 @@ describe("AcpAdapterV2", () => {
95329127 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
95339128 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
95349129 const instanceId = ProviderInstanceId.make("acp-test");
9535 const adapter = makeAcpAdapterV2({
9536 crypto: yield* Crypto.Crypto,
9130 const adapter = yield* makeAcpAdapterV2({
95379131 instanceId,
95389132 flavor: {
95399133 driver: ACP_TEST_DRIVER,
......@@ -9551,9 +9145,6 @@ describe("AcpAdapterV2", () => {
95519145 }),
95529146 }),
95539147 },
9554 fileSystem,
9555 idAllocator,
9556 host,
95579148 selfInvocation,
95589149 continuationRequests: {
95599150 offer: (request) =>
......@@ -9640,10 +9231,8 @@ describe("AcpAdapterV2", () => {
96409231 it.effect("keeps a buffered continuation current when a user turn starts before dispatch", () =>
96419232 Effect.gen(function* () {
96429233 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9643 const fileSystem = yield* FileSystem.FileSystem;
96449234 const idAllocator = yield* IdAllocator.IdAllocatorV2;
96459235 const path = yield* Path.Path;
9646 const host = yield* ProviderHost.ProviderHost;
96479236 const selfInvocation = yield* resolveSelfInvocation();
96489237 const mockAgentPath = yield* path.fromFileUrl(
96499238 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9656,8 +9245,7 @@ describe("AcpAdapterV2", () => {
96569245 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
96579246 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
96589247 const instanceId = ProviderInstanceId.make("acp-test");
9659 const adapter = makeAcpAdapterV2({
9660 crypto: yield* Crypto.Crypto,
9248 const adapter = yield* makeAcpAdapterV2({
96619249 instanceId,
96629250 flavor: {
96639251 driver: ACP_TEST_DRIVER,
......@@ -9687,9 +9275,6 @@ describe("AcpAdapterV2", () => {
96879275 }),
96889276 }),
96899277 },
9690 fileSystem,
9691 idAllocator,
9692 host,
96939278 selfInvocation,
96949279 continuationRequests: {
96959280 offer: (request) =>
......@@ -9852,7 +9437,6 @@ describe("AcpAdapterV2", () => {
98529437 const fileSystem = yield* FileSystem.FileSystem;
98539438 const idAllocator = yield* IdAllocator.IdAllocatorV2;
98549439 const path = yield* Path.Path;
9855 const host = yield* ProviderHost.ProviderHost;
98569440 const selfInvocation = yield* resolveSelfInvocation();
98579441 const mockAgentPath = yield* path.fromFileUrl(
98589442 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -9861,8 +9445,7 @@ describe("AcpAdapterV2", () => {
98619445 const triggerPath = path.join(triggerDir, "report-trigger");
98629446 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
98639447 const instanceId = ProviderInstanceId.make("acp-test");
9864 const adapter = makeAcpAdapterV2({
9865 crypto: yield* Crypto.Crypto,
9448 const adapter = yield* makeAcpAdapterV2({
98669449 instanceId,
98679450 flavor: {
98689451 driver: ACP_TEST_DRIVER,
......@@ -9894,9 +9477,6 @@ describe("AcpAdapterV2", () => {
98949477 protocolEvents,
98959478 }),
98969479 },
9897 fileSystem,
9898 idAllocator,
9899 host,
99009480 selfInvocation,
99019481 });
99029482 const threadId = ThreadId.make("thread-acp-injected-report-hold");
......@@ -10018,7 +9598,6 @@ describe("AcpAdapterV2", () => {
100189598 const fileSystem = yield* FileSystem.FileSystem;
100199599 const idAllocator = yield* IdAllocator.IdAllocatorV2;
100209600 const path = yield* Path.Path;
10021 const host = yield* ProviderHost.ProviderHost;
100229601 const selfInvocation = yield* resolveSelfInvocation();
100239602 const mockAgentPath = yield* path.fromFileUrl(
100249603 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -10037,8 +9616,7 @@ describe("AcpAdapterV2", () => {
100379616 | null;
100389617 } = { current: null };
100399618 const instanceId = ProviderInstanceId.make("acp-test");
10040 const adapter = makeAcpAdapterV2({
10041 crypto: yield* Crypto.Crypto,
9619 const adapter = yield* makeAcpAdapterV2({
100429620 instanceId,
100439621 flavor: {
100449622 driver: ACP_TEST_DRIVER,
......@@ -10075,9 +9653,6 @@ describe("AcpAdapterV2", () => {
100759653 protocolEvents,
100769654 }),
100779655 },
10078 fileSystem,
10079 idAllocator,
10080 host,
100819656 selfInvocation,
100829657 continuationRequests: {
100839658 offer: (request) =>
......@@ -10217,10 +9792,8 @@ describe("AcpAdapterV2", () => {
102179792 () =>
102189793 Effect.gen(function* () {
102199794 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10220 const fileSystem = yield* FileSystem.FileSystem;
102219795 const idAllocator = yield* IdAllocator.IdAllocatorV2;
102229796 const path = yield* Path.Path;
10223 const host = yield* ProviderHost.ProviderHost;
102249797 const selfInvocation = yield* resolveSelfInvocation();
102259798 const mockAgentPath = yield* path.fromFileUrl(
102269799 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -10240,8 +9813,7 @@ describe("AcpAdapterV2", () => {
102409813 | null;
102419814 } = { current: null };
102429815 const instanceId = ProviderInstanceId.make("acp-test");
10243 const adapter = makeAcpAdapterV2({
10244 crypto: yield* Crypto.Crypto,
9816 const adapter = yield* makeAcpAdapterV2({
102459817 instanceId,
102469818 flavor: {
102479819 driver: ACP_TEST_DRIVER,
......@@ -10273,9 +9845,6 @@ describe("AcpAdapterV2", () => {
102739845 }),
102749846 }),
102759847 },
10276 fileSystem,
10277 idAllocator,
10278 host,
102799848 selfInvocation,
102809849 continuationRequests: {
102819850 offer: (request) =>
......@@ -10457,10 +10026,8 @@ describe("AcpAdapterV2", () => {
1045710026 () =>
1045810027 Effect.gen(function* () {
1045910028 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10460 const fileSystem = yield* FileSystem.FileSystem;
1046110029 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1046210030 const path = yield* Path.Path;
10463 const host = yield* ProviderHost.ProviderHost;
1046410031 const selfInvocation = yield* resolveSelfInvocation();
1046510032 const mockAgentPath = yield* path.fromFileUrl(
1046610033 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -10480,8 +10047,7 @@ describe("AcpAdapterV2", () => {
1048010047 | null;
1048110048 } = { current: null };
1048210049 const instanceId = ProviderInstanceId.make("acp-test");
10483 const adapter = makeAcpAdapterV2({
10484 crypto: yield* Crypto.Crypto,
10050 const adapter = yield* makeAcpAdapterV2({
1048510051 instanceId,
1048610052 flavor: {
1048710053 driver: ACP_TEST_DRIVER,
......@@ -10520,9 +10086,6 @@ describe("AcpAdapterV2", () => {
1052010086 }),
1052110087 }),
1052210088 },
10523 fileSystem,
10524 idAllocator,
10525 host,
1052610089 selfInvocation,
1052710090 continuationRequests: {
1052810091 offer: (request) =>
......@@ -10676,10 +10239,8 @@ describe("AcpAdapterV2", () => {
1067610239 () =>
1067710240 Effect.gen(function* () {
1067810241 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10679 const fileSystem = yield* FileSystem.FileSystem;
1068010242 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1068110243 const path = yield* Path.Path;
10682 const host = yield* ProviderHost.ProviderHost;
1068310244 const selfInvocation = yield* resolveSelfInvocation();
1068410245 const mockAgentPath = yield* path.fromFileUrl(
1068510246 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -10699,8 +10260,7 @@ describe("AcpAdapterV2", () => {
1069910260 | null;
1070010261 } = { current: null };
1070110262 const instanceId = ProviderInstanceId.make("acp-test");
10702 const adapter = makeAcpAdapterV2({
10703 crypto: yield* Crypto.Crypto,
10263 const adapter = yield* makeAcpAdapterV2({
1070410264 instanceId,
1070510265 flavor: {
1070610266 driver: ACP_TEST_DRIVER,
......@@ -10743,9 +10303,6 @@ describe("AcpAdapterV2", () => {
1074310303 }),
1074410304 }),
1074510305 },
10746 fileSystem,
10747 idAllocator,
10748 host,
1074910306 selfInvocation,
1075010307 continuationRequests: {
1075110308 offer: (request) =>
......@@ -10891,10 +10448,8 @@ describe("AcpAdapterV2", () => {
1089110448 () =>
1089210449 Effect.gen(function* () {
1089310450 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10894 const fileSystem = yield* FileSystem.FileSystem;
1089510451 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1089610452 const path = yield* Path.Path;
10897 const host = yield* ProviderHost.ProviderHost;
1089810453 const selfInvocation = yield* resolveSelfInvocation();
1089910454 const mockAgentPath = yield* path.fromFileUrl(
1090010455 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -10914,8 +10469,7 @@ describe("AcpAdapterV2", () => {
1091410469 | null;
1091510470 } = { current: null };
1091610471 const instanceId = ProviderInstanceId.make("acp-test");
10917 const adapter = makeAcpAdapterV2({
10918 crypto: yield* Crypto.Crypto,
10472 const adapter = yield* makeAcpAdapterV2({
1091910473 instanceId,
1092010474 flavor: {
1092110475 driver: ACP_TEST_DRIVER,
......@@ -10980,9 +10534,6 @@ describe("AcpAdapterV2", () => {
1098010534 }),
1098110535 }),
1098210536 },
10983 fileSystem,
10984 idAllocator,
10985 host,
1098610537 selfInvocation,
1098710538 continuationRequests: {
1098810539 offer: (request) =>
......@@ -11263,10 +10814,8 @@ describe("AcpAdapterV2", () => {
1126310814 it.effect("a wake names work that ended while the previous wake was queued", () =>
1126410815 Effect.gen(function* () {
1126510816 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11266 const fileSystem = yield* FileSystem.FileSystem;
1126710817 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1126810818 const path = yield* Path.Path;
11269 const host = yield* ProviderHost.ProviderHost;
1127010819 const selfInvocation = yield* resolveSelfInvocation();
1127110820 const mockAgentPath = yield* path.fromFileUrl(
1127210821 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -11277,8 +10826,7 @@ describe("AcpAdapterV2", () => {
1127710826 let applyMutation: AcpAdapterV2ExtensionContext["applyBackgroundTaskMutation"] | undefined;
1127810827 const promptGate = yield* Deferred.make<EffectAcpSchema.PromptResponse>();
1127910828 const instanceId = ProviderInstanceId.make("acp-test");
11280 const adapter = makeAcpAdapterV2({
11281 crypto: yield* Crypto.Crypto,
10829 const adapter = yield* makeAcpAdapterV2({
1128210830 instanceId,
1128310831 flavor: {
1128410832 driver: ACP_TEST_DRIVER,
......@@ -11303,9 +10851,6 @@ describe("AcpAdapterV2", () => {
1130310851 }),
1130410852 }),
1130510853 },
11306 fileSystem,
11307 idAllocator,
11308 host,
1130910854 selfInvocation,
1131010855 continuationRequests: {
1131110856 offer: (request) =>
......@@ -11417,10 +10962,8 @@ describe("AcpAdapterV2", () => {
1141710962 it.effect("mid-turn completed mutation defers offer until finalize only when unhandled", () =>
1141810963 Effect.gen(function* () {
1141910964 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11420 const fileSystem = yield* FileSystem.FileSystem;
1142110965 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1142210966 const path = yield* Path.Path;
11423 const host = yield* ProviderHost.ProviderHost;
1142410967 const selfInvocation = yield* resolveSelfInvocation();
1142510968 const mockAgentPath = yield* path.fromFileUrl(
1142610969 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -11440,8 +10983,7 @@ describe("AcpAdapterV2", () => {
1144010983 | null;
1144110984 } = { current: null };
1144210985 const instanceId = ProviderInstanceId.make("acp-test");
11443 const adapter = makeAcpAdapterV2({
11444 crypto: yield* Crypto.Crypto,
10986 const adapter = yield* makeAcpAdapterV2({
1144510987 instanceId,
1144610988 flavor: {
1144710989 driver: ACP_TEST_DRIVER,
......@@ -11487,9 +11029,6 @@ describe("AcpAdapterV2", () => {
1148711029 }),
1148811030 }),
1148911031 },
11490 fileSystem,
11491 idAllocator,
11492 host,
1149311032 selfInvocation,
1149411033 continuationRequests: {
1149511034 offer: (request) =>
......@@ -11748,10 +11287,8 @@ describe("AcpAdapterV2", () => {
1174811287 () =>
1174911288 Effect.gen(function* () {
1175011289 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11751 const fileSystem = yield* FileSystem.FileSystem;
1175211290 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1175311291 const path = yield* Path.Path;
11754 const host = yield* ProviderHost.ProviderHost;
1175511292 const selfInvocation = yield* resolveSelfInvocation();
1175611293 const mockAgentPath = yield* path.fromFileUrl(
1175711294 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -11771,8 +11308,7 @@ describe("AcpAdapterV2", () => {
1177111308 | null;
1177211309 } = { current: null };
1177311310 const instanceId = ProviderInstanceId.make("acp-test");
11774 const adapter = makeAcpAdapterV2({
11775 crypto: yield* Crypto.Crypto,
11311 const adapter = yield* makeAcpAdapterV2({
1177611312 instanceId,
1177711313 flavor: {
1177811314 driver: ACP_TEST_DRIVER,
......@@ -11799,9 +11335,6 @@ describe("AcpAdapterV2", () => {
1179911335 }),
1180011336 }),
1180111337 },
11802 fileSystem,
11803 idAllocator,
11804 host,
1180511338 selfInvocation,
1180611339 continuationRequests: {
1180711340 offer: (request) =>
......@@ -11935,10 +11468,8 @@ describe("AcpAdapterV2", () => {
1193511468 it.effect("empty-drain continuation turn waits the quiet window so late frames can attach", () =>
1193611469 Effect.gen(function* () {
1193711470 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11938 const fileSystem = yield* FileSystem.FileSystem;
1193911471 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1194011472 const path = yield* Path.Path;
11941 const host = yield* ProviderHost.ProviderHost;
1194211473 const selfInvocation = yield* resolveSelfInvocation();
1194311474 const mockAgentPath = yield* path.fromFileUrl(
1194411475 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -11958,8 +11489,7 @@ describe("AcpAdapterV2", () => {
1195811489 | null;
1195911490 } = { current: null };
1196011491 const instanceId = ProviderInstanceId.make("acp-test");
11961 const adapter = makeAcpAdapterV2({
11962 crypto: yield* Crypto.Crypto,
11492 const adapter = yield* makeAcpAdapterV2({
1196311493 instanceId,
1196411494 flavor: {
1196511495 driver: ACP_TEST_DRIVER,
......@@ -11990,9 +11520,6 @@ describe("AcpAdapterV2", () => {
1199011520 }),
1199111521 }),
1199211522 },
11993 fileSystem,
11994 idAllocator,
11995 host,
1199611523 selfInvocation,
1199711524 continuationRequests: {
1199811525 offer: (request) =>
......@@ -12179,10 +11706,8 @@ describe("AcpAdapterV2", () => {
1217911706 it.effect("empty-drain continuation turn finalizes after the quiet window with no frames", () =>
1218011707 Effect.gen(function* () {
1218111708 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12182 const fileSystem = yield* FileSystem.FileSystem;
1218311709 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1218411710 const path = yield* Path.Path;
12185 const host = yield* ProviderHost.ProviderHost;
1218611711 const selfInvocation = yield* resolveSelfInvocation();
1218711712 const mockAgentPath = yield* path.fromFileUrl(
1218811713 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -12202,8 +11727,7 @@ describe("AcpAdapterV2", () => {
1220211727 | null;
1220311728 } = { current: null };
1220411729 const instanceId = ProviderInstanceId.make("acp-test");
12205 const adapter = makeAcpAdapterV2({
12206 crypto: yield* Crypto.Crypto,
11730 const adapter = yield* makeAcpAdapterV2({
1220711731 instanceId,
1220811732 flavor: {
1220911733 driver: ACP_TEST_DRIVER,
......@@ -12232,9 +11756,6 @@ describe("AcpAdapterV2", () => {
1223211756 }),
1223311757 }),
1223411758 },
12235 fileSystem,
12236 idAllocator,
12237 host,
1223811759 selfInvocation,
1223911760 continuationRequests: {
1224011761 offer: (request) =>
......@@ -12369,18 +11890,15 @@ describe("AcpAdapterV2", () => {
1236911890 it.effect("restarts the ACP child process before the next prompt after interrupt", () =>
1237011891 Effect.gen(function* () {
1237111892 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12372 const fileSystem = yield* FileSystem.FileSystem;
1237311893 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1237411894 const path = yield* Path.Path;
12375 const host = yield* ProviderHost.ProviderHost;
1237611895 const selfInvocation = yield* resolveSelfInvocation();
1237711896 const mockAgentPath = yield* path.fromFileUrl(
1237811897 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1237911898 );
1238011899 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
1238111900 const instanceId = ProviderInstanceId.make("acp-test");
12382 const adapter = makeAcpAdapterV2({
12383 crypto: yield* Crypto.Crypto,
11901 const adapter = yield* makeAcpAdapterV2({
1238411902 instanceId,
1238511903 flavor: {
1238611904 driver: ACP_TEST_DRIVER,
......@@ -12392,9 +11910,6 @@ describe("AcpAdapterV2", () => {
1239211910 protocolEvents,
1239311911 }),
1239411912 },
12395 fileSystem,
12396 idAllocator,
12397 host,
1239811913 selfInvocation,
1239911914 });
1240011915 const threadId = ThreadId.make("thread-acp-restart-after-interrupt");
......@@ -12618,7 +12133,6 @@ describe("AcpAdapterV2", () => {
1261812133 const fileSystem = yield* FileSystem.FileSystem;
1261912134 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1262012135 const path = yield* Path.Path;
12621 const host = yield* ProviderHost.ProviderHost;
1262212136 const selfInvocation = yield* resolveSelfInvocation();
1262312137 const mockAgentPath = yield* path.fromFileUrl(
1262412138 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -12635,8 +12149,7 @@ describe("AcpAdapterV2", () => {
1263512149 const releaseTeardown = yield* Deferred.make<void>();
1263612150 let terminatorCallCount = 0;
1263712151 const instanceId = ProviderInstanceId.make("acp-test");
12638 const adapter = makeAcpAdapterV2({
12639 crypto: yield* Crypto.Crypto,
12152 const adapter = yield* makeAcpAdapterV2({
1264012153 instanceId,
1264112154 flavor: {
1264212155 driver: ACP_TEST_DRIVER,
......@@ -12665,9 +12178,6 @@ describe("AcpAdapterV2", () => {
1266512178 protocolEvents,
1266612179 }),
1266712180 },
12668 fileSystem,
12669 idAllocator,
12670 host,
1267112181 selfInvocation,
1267212182 continuationRequests: {
1267312183 offer: (request) =>
......@@ -12833,18 +12343,15 @@ describe("AcpAdapterV2", () => {
1283312343 it.live("durably poisons start and resume when required hard teardown is unavailable", () =>
1283412344 Effect.gen(function* () {
1283512345 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12836 const fileSystem = yield* FileSystem.FileSystem;
1283712346 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1283812347 const path = yield* Path.Path;
12839 const host = yield* ProviderHost.ProviderHost;
1284012348 const selfInvocation = yield* resolveSelfInvocation();
1284112349 const mockAgentPath = yield* path.fromFileUrl(
1284212350 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1284312351 );
1284412352 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
1284512353 const instanceId = ProviderInstanceId.make("acp-test");
12846 const adapter = makeAcpAdapterV2({
12847 crypto: yield* Crypto.Crypto,
12354 const adapter = yield* makeAcpAdapterV2({
1284812355 instanceId,
1284912356 flavor: {
1285012357 driver: ACP_TEST_DRIVER,
......@@ -12858,9 +12365,6 @@ describe("AcpAdapterV2", () => {
1285812365 protocolEvents,
1285912366 }),
1286012367 },
12861 fileSystem,
12862 idAllocator,
12863 host,
1286412368 selfInvocation,
1286512369 });
1286612370 const threadId = ThreadId.make("thread-acp-missing-hard-teardown");
......@@ -12922,10 +12426,8 @@ describe("AcpAdapterV2", () => {
1292212426 it.live("holds concurrent startTurn behind successful hard teardown and reloads once", () =>
1292312427 Effect.gen(function* () {
1292412428 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12925 const fileSystem = yield* FileSystem.FileSystem;
1292612429 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1292712430 const path = yield* Path.Path;
12928 const host = yield* ProviderHost.ProviderHost;
1292912431 const selfInvocation = yield* resolveSelfInvocation();
1293012432 const mockAgentPath = yield* path.fromFileUrl(
1293112433 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -12935,8 +12437,7 @@ describe("AcpAdapterV2", () => {
1293512437 const releaseTeardown = yield* Deferred.make<void>();
1293612438 let runtimeOrdinalSeen = 0;
1293712439 const instanceId = ProviderInstanceId.make("acp-test");
12938 const adapter = makeAcpAdapterV2({
12939 crypto: yield* Crypto.Crypto,
12440 const adapter = yield* makeAcpAdapterV2({
1294012441 instanceId,
1294112442 flavor: {
1294212443 driver: ACP_TEST_DRIVER,
......@@ -12960,9 +12461,6 @@ describe("AcpAdapterV2", () => {
1296012461 protocolEvents,
1296112462 }),
1296212463 },
12963 fileSystem,
12964 idAllocator,
12965 host,
1296612464 selfInvocation,
1296712465 });
1296812466 const threadId = ThreadId.make("thread-acp-concurrent-hard-teardown");
......@@ -13035,10 +12533,8 @@ describe("AcpAdapterV2", () => {
1303512533 it.live("quarantines old-runtime callbacks after successful hard teardown", () =>
1303612534 Effect.gen(function* () {
1303712535 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13038 const fileSystem = yield* FileSystem.FileSystem;
1303912536 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1304012537 const path = yield* Path.Path;
13041 const host = yield* ProviderHost.ProviderHost;
1304212538 const selfInvocation = yield* resolveSelfInvocation();
1304312539 const mockAgentPath = yield* path.fromFileUrl(
1304412540 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -13101,8 +12597,7 @@ describe("AcpAdapterV2", () => {
1310112597 };
1310212598 },
1310312599 });
13104 const adapter = makeAcpAdapterV2({
13105 crypto: yield* Crypto.Crypto,
12600 const adapter = yield* makeAcpAdapterV2({
1310612601 instanceId,
1310712602 flavor: {
1310812603 driver: ACP_TEST_DRIVER,
......@@ -13119,9 +12614,6 @@ describe("AcpAdapterV2", () => {
1311912614 runtimeInputs.push(runtimeInput);
1312012615 }).pipe(Effect.andThen(makeRuntime(runtimeInput))),
1312112616 },
13122 fileSystem,
13123 idAllocator,
13124 host,
1312512617 selfInvocation,
1312612618 testHooks: {
1312712619 afterHardTeardownTransportDrained: () =>
......@@ -13397,18 +12889,14 @@ describe("AcpAdapterV2", () => {
1339712889 it.live("keeps stale deferred cleanup inert while replacement requests remain live", () =>
1339812890 Effect.gen(function* () {
1339912891 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13400 const fileSystem = yield* FileSystem.FileSystem;
13401 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1340212892 const path = yield* Path.Path;
13403 const host = yield* ProviderHost.ProviderHost;
1340412893 const selfInvocation = yield* resolveSelfInvocation();
1340512894 const mockAgentPath = yield* path.fromFileUrl(
1340612895 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1340712896 );
1340812897 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
1340912898 const instanceId = ProviderInstanceId.make("acp-test");
13410 const adapter = makeAcpAdapterV2({
13411 crypto: yield* Crypto.Crypto,
12899 const adapter = yield* makeAcpAdapterV2({
1341212900 instanceId,
1341312901 flavor: {
1341412902 driver: ACP_TEST_DRIVER,
......@@ -13425,9 +12913,6 @@ describe("AcpAdapterV2", () => {
1342512913 protocolEvents,
1342612914 }),
1342712915 },
13428 fileSystem,
13429 idAllocator,
13430 host,
1343112916 selfInvocation,
1343212917 });
1343312918 const threadId = ThreadId.make("thread-acp-stale-deferred-cleanup");
......@@ -13522,10 +13007,8 @@ describe("AcpAdapterV2", () => {
1352213007 it.live("resolves owner cancellation and concurrent resume waiters after hard teardown", () =>
1352313008 Effect.gen(function* () {
1352413009 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13525 const fileSystem = yield* FileSystem.FileSystem;
1352613010 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1352713011 const path = yield* Path.Path;
13528 const host = yield* ProviderHost.ProviderHost;
1352913012 const selfInvocation = yield* resolveSelfInvocation();
1353013013 const mockAgentPath = yield* path.fromFileUrl(
1353113014 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -13535,8 +13018,7 @@ describe("AcpAdapterV2", () => {
1353513018 const releaseTeardown = yield* Deferred.make<void>();
1353613019 let runtimeOrdinalSeen = 0;
1353713020 const instanceId = ProviderInstanceId.make("acp-test");
13538 const adapter = makeAcpAdapterV2({
13539 crypto: yield* Crypto.Crypto,
13021 const adapter = yield* makeAcpAdapterV2({
1354013022 instanceId,
1354113023 flavor: {
1354213024 driver: ACP_TEST_DRIVER,
......@@ -13560,9 +13042,6 @@ describe("AcpAdapterV2", () => {
1356013042 protocolEvents,
1356113043 }),
1356213044 },
13563 fileSystem,
13564 idAllocator,
13565 host,
1356613045 selfInvocation,
1356713046 });
1356813047 const threadId = ThreadId.make("thread-acp-concurrent-resume-teardown");
......@@ -13659,7 +13138,6 @@ describe("AcpAdapterV2", () => {
1365913138 const fileSystem = yield* FileSystem.FileSystem;
1366013139 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1366113140 const path = yield* Path.Path;
13662 const host = yield* ProviderHost.ProviderHost;
1366313141 const selfInvocation = yield* resolveSelfInvocation();
1366413142 const mockAgentPath = yield* path.fromFileUrl(
1366513143 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -13673,8 +13151,7 @@ describe("AcpAdapterV2", () => {
1367313151 );
1367413152 let cancelCalled = false;
1367513153 const instanceId = ProviderInstanceId.make("acp-test");
13676 const adapter = makeAcpAdapterV2({
13677 crypto: yield* Crypto.Crypto,
13154 const adapter = yield* makeAcpAdapterV2({
1367813155 instanceId,
1367913156 flavor: {
1368013157 driver: ACP_TEST_DRIVER,
......@@ -13711,9 +13188,6 @@ describe("AcpAdapterV2", () => {
1371113188 }).pipe(Effect.andThen(Effect.never)),
1371213189 }),
1371313190 },
13714 fileSystem,
13715 idAllocator,
13716 host,
1371713191 selfInvocation,
1371813192 continuationRequests: { offer: () => Effect.void },
1371913193 });
......@@ -13933,10 +13407,8 @@ describe("AcpAdapterV2", () => {
1393313407 () =>
1393413408 Effect.gen(function* () {
1393513409 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13936 const fileSystem = yield* FileSystem.FileSystem;
1393713410 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1393813411 const path = yield* Path.Path;
13939 const host = yield* ProviderHost.ProviderHost;
1394013412 const selfInvocation = yield* resolveSelfInvocation();
1394113413 const mockAgentPath = yield* path.fromFileUrl(
1394213414 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -13944,12 +13416,11 @@ describe("AcpAdapterV2", () => {
1394413416 const instanceId = ProviderInstanceId.make("acp-test");
1394513417 let subagentPhase: "spawn" | "complete" = "spawn";
1394613418 const promptSettled = yield* Deferred.make<void>();
13947 const adapter = makeAcpAdapterV2({
13419 const adapter = yield* makeAcpAdapterV2({
1394813420 testHooks: {
1394913421 afterPromptSettledWithBackgroundWork: () =>
1395013422 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
1395113423 },
13952 crypto: yield* Crypto.Crypto,
1395313424 instanceId,
1395413425 flavor: {
1395513426 driver: ACP_TEST_DRIVER,
......@@ -13984,9 +13455,6 @@ describe("AcpAdapterV2", () => {
1398413455 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
1398513456 }),
1398613457 },
13987 fileSystem,
13988 idAllocator,
13989 host,
1399013458 selfInvocation,
1399113459 });
1399213460 const threadId = ThreadId.make("thread-acp-direct-stop-subagent-hold");
......@@ -14090,7 +13558,6 @@ describe("AcpAdapterV2", () => {
1409013558 const fileSystem = yield* FileSystem.FileSystem;
1409113559 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1409213560 const path = yield* Path.Path;
14093 const host = yield* ProviderHost.ProviderHost;
1409413561 const selfInvocation = yield* resolveSelfInvocation();
1409513562 const mockAgentPath = yield* path.fromFileUrl(
1409613563 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -14103,8 +13570,7 @@ describe("AcpAdapterV2", () => {
1410313570 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),
1410413571 );
1410513572 const instanceId = ProviderInstanceId.make("acp-test");
14106 const adapter = makeAcpAdapterV2({
14107 crypto: yield* Crypto.Crypto,
13573 const adapter = yield* makeAcpAdapterV2({
1410813574 instanceId,
1410913575 flavor: {
1411013576 driver: ACP_TEST_DRIVER,
......@@ -14133,9 +13599,6 @@ describe("AcpAdapterV2", () => {
1413313599 wrapCancel: (cancel) => cancel.pipe(Effect.andThen(Effect.sleep("250 millis"))),
1413413600 }),
1413513601 },
14136 fileSystem,
14137 idAllocator,
14138 host,
1413913602 selfInvocation,
1414013603 });
1414113604 const threadId = ThreadId.make("thread-acp-restart-active-in-process");
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts+3-21
......@@ -4,7 +4,6 @@ import { ProviderInstanceId, ProviderSessionId, ThreadId } from "@t3tools/contra
44import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
55import * as Deferred from "effect/Deferred";
66import * as Effect from "effect/Effect";
7import * as Crypto from "effect/Crypto";
87import * as FileSystem from "effect/FileSystem";
98import * as Layer from "effect/Layer";
109import * as Option from "effect/Option";
......@@ -188,8 +187,7 @@ describe("AcpRegistryAdapterV2", () => {
188187 ACP_REGISTRY_PROVIDER,
189188 );
190189 const instanceId = ProviderInstanceId.make("acp-registry-mode-pick");
191 const adapter = makeAcpRegistryAdapterV2({
192 crypto: yield* Crypto.Crypto,
190 const adapter = yield* makeAcpRegistryAdapterV2({
193191 selfInvocation: yield* resolveSelfInvocation(),
194192 instanceId,
195193 settings: yield* decodeAcpRegistryAdapterSettings({
......@@ -198,10 +196,7 @@ describe("AcpRegistryAdapterV2", () => {
198196 }),
199197 environment: {},
200198 childProcessSpawner,
201 fileSystem,
202 idAllocator: yield* IdAllocator.IdAllocatorV2,
203199 resolver: { resolve: () => Effect.die("the runtime is injected") },
204 host: yield* ProviderHost.ProviderHost,
205200 makeRuntime: makeAcpReplayRuntime({
206201 transcript,
207202 statusPath,
......@@ -268,10 +263,7 @@ describe("AcpRegistryAdapterV2", () => {
268263 it.effect("offers client terminals to Devin only and client fs to no registry agent", () =>
269264 Effect.gen(function* () {
270265 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
271 const fileSystem = yield* FileSystem.FileSystem;
272 const idAllocator = yield* IdAllocator.IdAllocatorV2;
273266 const path = yield* Path.Path;
274 const host = yield* ProviderHost.ProviderHost;
275267 const mockAgentPath = yield* path.fromFileUrl(
276268 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
277269 );
......@@ -280,17 +272,13 @@ describe("AcpRegistryAdapterV2", () => {
280272 ) {
281273 let clientCapabilities: unknown;
282274 const instanceId = ProviderInstanceId.make(`acp-registry-capabilities-${agentId}`);
283 const adapter = makeAcpRegistryAdapterV2({
284 crypto: yield* Crypto.Crypto,
275 const adapter = yield* makeAcpRegistryAdapterV2({
285276 selfInvocation: yield* resolveSelfInvocation(),
286277 instanceId,
287278 settings: yield* decodeAcpRegistryAdapterSettings({ agentId, authMethodId: "test" }),
288279 environment: {},
289280 childProcessSpawner,
290 fileSystem,
291 idAllocator,
292281 resolver: { resolve: () => Effect.die("the runtime is injected") },
293 host,
294282 makeRuntime: (input) =>
295283 Effect.gen(function* () {
296284 clientCapabilities = input.clientCapabilities;
......@@ -344,8 +332,6 @@ describe("AcpRegistryAdapterV2", () => {
344332 it.effect("opens a real ACP child process resolved from registry configuration", () =>
345333 Effect.gen(function* () {
346334 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
347 const fileSystem = yield* FileSystem.FileSystem;
348 const idAllocator = yield* IdAllocator.IdAllocatorV2;
349335 const path = yield* Path.Path;
350336 const host = yield* ProviderHost.ProviderHost;
351337 const mockAgentPath = yield* path.fromFileUrl(
......@@ -369,8 +355,7 @@ describe("AcpRegistryAdapterV2", () => {
369355 readonly commands: AcpRegistryAvailableCommands;
370356 }>();
371357 const configurationPublished = yield* Deferred.make<AcpRegistryLiveConfiguration>();
372 const adapter = makeAcpRegistryAdapterV2({
373 crypto: yield* Crypto.Crypto,
358 const adapter = yield* makeAcpRegistryAdapterV2({
374359 selfInvocation: yield* resolveSelfInvocation(),
375360 instanceId,
376361 settings,
......@@ -379,8 +364,6 @@ describe("AcpRegistryAdapterV2", () => {
379364 T3_ACP_COMMAND_ADVERTISEMENT_DELAY_MS: "750",
380365 },
381366 childProcessSpawner,
382 fileSystem,
383 idAllocator,
384367 runtimeCoordinator: {
385368 withForegroundStartup: (agentId, effect) =>
386369 Effect.acquireUseRelease(
......@@ -428,7 +411,6 @@ describe("AcpRegistryAdapterV2", () => {
428411 })),
429412 ),
430413 },
431 host,
432414 });
433415 const threadId = ThreadId.make("thread-acp-registry-fixture");
434416 const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.testkit.ts+1-10
......@@ -2,14 +2,12 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
22import { AcpRegistrySettings } from "@t3tools/contracts";
33import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
44import * as Effect from "effect/Effect";
5import * as Crypto from "effect/Crypto";
65import * as FileSystem from "effect/FileSystem";
76import * as Layer from "effect/Layer";
87import * as Path from "effect/Path";
98import * as Schema from "effect/Schema";
109import { ChildProcessSpawner } from "effect/process";
1110
12import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
1311import { layerTestProviderHost } from "@t3tools/provider-testing/host";
1412import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
1513import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
......@@ -44,9 +42,6 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
4442 const fileSystem = yield* FileSystem.FileSystem;
4543 const path = yield* Path.Path;
4644 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
47 const crypto = yield* Crypto.Crypto;
48 const idAllocator = yield* IdAllocator.IdAllocatorV2;
49 const host = yield* ProviderHost.ProviderHost;
5045 const replayGate = options.replayGate;
5146 const replayDir = yield* fileSystem
5247 .makeTempDirectory({
......@@ -57,18 +52,14 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
5752 const scriptPath = yield* path
5853 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))
5954 .pipe(Effect.orDie);
60 const adapter = makeAcpRegistryAdapterV2({
55 const adapter = yield* makeAcpRegistryAdapterV2({
6156 instanceId: ACP_REGISTRY_DEFAULT_INSTANCE_ID,
6257 settings: REPLAY_SETTINGS,
6358 environment: {},
6459 childProcessSpawner,
65 crypto,
66 fileSystem,
67 idAllocator,
6860 resolver: {
6961 resolve: () => Effect.die("ACP registry resolver must not run during replay"),
7062 },
71 host,
7263 selfInvocation: yield* resolveSelfInvocation(),
7364 makeRuntime: makeAcpReplayRuntime({
7465 transcript,
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.ts+6-20
......@@ -59,13 +59,9 @@ export interface AcpRegistryAdapterV2Options {
5959 readonly settings: AcpRegistrySettings;
6060 readonly environment: NodeJS.ProcessEnv;
6161 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
62 readonly crypto: Crypto.Crypto;
6362 readonly selfInvocation: SelfInvocation;
64 readonly fileSystem: FileSystem.FileSystem;
65 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
6663 readonly resolver: Pick<AcpRegistrySupport.AcpRegistryCatalog["Service"], "resolve">;
6764 readonly runtimeCoordinator?: AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator["Service"];
68 readonly host: ProviderHost.ProviderHostShape;
6965 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
7066 readonly makeRuntime?: (
7167 input: AcpAdapterV2RuntimeInput,
......@@ -181,7 +177,9 @@ function makeAcpRegistryRuntime(options: AcpRegistryAdapterV2Options) {
181177 });
182178}
183179
184export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
180export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(function* (
181 options: AcpRegistryAdapterV2Options,
182) {
185183 const runtimeCoordinator = options.runtimeCoordinator;
186184 const registryAgentId = options.settings.source === "local" ? "" : options.settings.agentId;
187185 const startupKey =
......@@ -237,13 +235,9 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
237235 }),
238236 ...(options.assertComplete === undefined ? {} : { assertComplete: options.assertComplete }),
239237 };
240 return makeAcpAdapterV2({
238 return yield* makeAcpAdapterV2({
241239 instanceId: options.instanceId,
242240 flavor,
243 crypto: options.crypto,
244 fileSystem: options.fileSystem,
245 idAllocator: options.idAllocator,
246 host: options.host,
247241 selfInvocation: options.selfInvocation,
248242 // Per-agent exception (see the note above registerMistralVibeAcpExtensions):
249243 // Devin runs commands through client terminals and has no ask mode over
......@@ -259,7 +253,7 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
259253 : {}),
260254 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
261255 });
262}
256});
263257
264258export type AcpRegistryAdapterV2DriverEnv =
265259 | ChildProcessSpawner.ChildProcessSpawner
......@@ -283,29 +277,21 @@ export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<
283277 const hostEnvironment = yield* HostProcessEnvironment;
284278 const selfInvocation = yield* resolveSelfInvocation();
285279 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
286 const crypto = yield* Crypto.Crypto;
287 const fileSystem = yield* FileSystem.FileSystem;
288 const idAllocator = yield* IdAllocator.IdAllocatorV2;
289280 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
290 const host = yield* ProviderHost.ProviderHost;
291281 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
292282 const resolver = yield* AcpRegistrySupport.AcpRegistryCatalog;
293283 const runtimeCoordinator = yield* Effect.serviceOption(
294284 AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator,
295285 );
296 return makeAcpRegistryAdapterV2({
286 return yield* makeAcpRegistryAdapterV2({
297287 instanceId: input.instanceId,
298288 settings: { ...input.config, enabled: input.enabled },
299289 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
300290 childProcessSpawner,
301 crypto,
302 fileSystem,
303 idAllocator,
304291 resolver,
305292 ...(Option.isSome(runtimeCoordinator)
306293 ? { runtimeCoordinator: runtimeCoordinator.value }
307294 : {}),
308 host,
309295 selfInvocation,
310296 nativeLogging: (threadId) =>
311297 makeNativeLogger({
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts+3-21
......@@ -38,7 +38,6 @@ const flavor = makeAntigravityAcpAdapterFlavor({
3838 crypto: undefined as never,
3939 fileSystem: undefined as never,
4040 path: undefined as never,
41 idAllocator: undefined as never,
4241 host: undefined as never,
4342 selfInvocation: undefined as never,
4443 makeRuntime: () => Effect.die("not spawned in this test"),
......@@ -149,14 +148,9 @@ describe("AntigravityAdapterV2 client file system", () => {
149148 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;
150149 const crypto = yield* Crypto.Crypto;
151150 const instanceId = ProviderInstanceId.make("antigravity-containment-test");
152 const adapter = makeAntigravityAdapterV2({
151 const adapter = yield* makeAntigravityAdapterV2({
153152 instanceId,
154 crypto,
155153 selfInvocation: yield* resolveSelfInvocation(),
156 fileSystem,
157 path,
158 idAllocator: yield* IdAllocator.IdAllocatorV2,
159 host,
160154 makeRuntime: (input) =>
161155 makeAntigravityAcpRuntime({
162156 ...input,
......@@ -293,7 +287,6 @@ describe("AntigravityAdapterV2 workspace changes", () => {
293287 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
294288 const fileSystem = yield* FileSystem.FileSystem;
295289 const path = yield* Path.Path;
296 const host = yield* ProviderHost.ProviderHost;
297290 const crypto = yield* Crypto.Crypto;
298291 const mockAgentPath = yield* path.fromFileUrl(
299292 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -301,14 +294,9 @@ describe("AntigravityAdapterV2 workspace changes", () => {
301294 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
302295 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;
303296 const instanceId = ProviderInstanceId.make("antigravity-workspace-change-test");
304 const adapter = makeAntigravityAdapterV2({
297 const adapter = yield* makeAntigravityAdapterV2({
305298 instanceId,
306 crypto,
307299 selfInvocation: yield* resolveSelfInvocation(),
308 fileSystem,
309 path,
310 idAllocator: yield* IdAllocator.IdAllocatorV2,
311 host,
312300 makeRuntime: (input) =>
313301 makeAntigravityAcpRuntime({
314302 ...input,
......@@ -430,7 +418,6 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
430418 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
431419 const fileSystem = yield* FileSystem.FileSystem;
432420 const path = yield* Path.Path;
433 const host = yield* ProviderHost.ProviderHost;
434421 const crypto = yield* Crypto.Crypto;
435422 const mockAgentPath = yield* path.fromFileUrl(
436423 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
......@@ -451,14 +438,9 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
451438 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;
452439 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;
453440 const instanceId = ProviderInstanceId.make(`antigravity-restrictive-${policy.runtimeMode}`);
454 const adapter = makeAntigravityAdapterV2({
441 const adapter = yield* makeAntigravityAdapterV2({
455442 instanceId,
456 crypto,
457443 selfInvocation: yield* resolveSelfInvocation(),
458 fileSystem,
459 path,
460 idAllocator: yield* IdAllocator.IdAllocatorV2,
461 host,
462444 makeRuntime: (input) =>
463445 makeAntigravityAcpRuntime({
464446 ...input,
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts+23-17
......@@ -8,8 +8,8 @@ import {
88import type { SelfInvocation } from "@t3tools/shared/nodeRuntime";
99import * as Crypto from "effect/Crypto";
1010import * as Effect from "effect/Effect";
11import type * as FileSystem from "effect/FileSystem";
12import type * as Path from "effect/Path";
11import * as FileSystem from "effect/FileSystem";
12import * as Path from "effect/Path";
1313import * as Exit from "effect/Exit";
1414import * as Scope from "effect/Scope";
1515import * as EffectAcpErrors from "effect-acp/errors";
......@@ -34,7 +34,6 @@ import {
3434 makeAntigravityUserInputResponse,
3535 normalizeAntigravityToolCall,
3636} from "../../provider/acp/AntigravityProtocol.ts";
37import type { IdAllocatorV2 } from "@t3tools/provider-core/server/IdAllocator";
3837import {
3938 AcpProviderCapabilitiesV2,
4039 makeAcpAdapterV2,
......@@ -63,12 +62,7 @@ const AntigravityProviderCapabilitiesV2 = {
6362
6463export interface AntigravityAdapterV2Options {
6564 readonly instanceId: ProviderInstanceId;
66 readonly crypto: Crypto.Crypto;
6765 readonly selfInvocation: SelfInvocation;
68 readonly fileSystem: FileSystem.FileSystem;
69 readonly path: Path.Path;
70 readonly idAllocator: IdAllocatorV2["Service"];
71 readonly host: ProviderHost.ProviderHostShape;
7266 /** Spawns the official agent with the instance's Google profile. */
7367 readonly makeRuntime: (
7468 input: Omit<AntigravityAcpRuntimeInput, "spawn" | "childProcessSpawner">,
......@@ -118,8 +112,16 @@ const extractAntigravitySubagentUpdate: NonNullable<AcpAdapterV2Flavor["extractS
118112 };
119113};
120114
115/** The services the Antigravity flavor runs its runtime and session files with. */
116interface AntigravityFlavorServices {
117 readonly crypto: Crypto.Crypto;
118 readonly fileSystem: FileSystem.FileSystem;
119 readonly path: Path.Path;
120 readonly host: ProviderHost.ProviderHost["Service"];
121}
122
121123export function makeAntigravityAcpAdapterFlavor(
122 options: AntigravityAdapterV2Options,
124 options: AntigravityAdapterV2Options & AntigravityFlavorServices,
123125): AcpAdapterV2Flavor {
124126 // The attachments dir grant lets the agent read pasted files at the paths
125127 // the turn text references. It is a leaf directory of uploads. A session
......@@ -224,18 +226,22 @@ export function makeAntigravityAcpAdapterFlavor(
224226 };
225227}
226228
227export function makeAntigravityAdapterV2(options: AntigravityAdapterV2Options) {
228 return makeAcpAdapterV2({
229export const makeAntigravityAdapterV2 = Effect.fn("makeAntigravityAdapterV2")(function* (
230 options: AntigravityAdapterV2Options,
231) {
232 const services: AntigravityFlavorServices = {
233 crypto: yield* Crypto.Crypto,
234 fileSystem: yield* FileSystem.FileSystem,
235 path: yield* Path.Path,
236 host: yield* ProviderHost.ProviderHost,
237 };
238 return yield* makeAcpAdapterV2({
229239 instanceId: options.instanceId,
230 flavor: makeAntigravityAcpAdapterFlavor(options),
231 crypto: options.crypto,
232 fileSystem: options.fileSystem,
233 idAllocator: options.idAllocator,
234 host: options.host,
240 flavor: makeAntigravityAcpAdapterFlavor({ ...options, ...services }),
235241 selfInvocation: options.selfInvocation,
236242 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
237243 ...(options.continuationRequests === undefined
238244 ? {}
239245 : { continuationRequests: options.continuationRequests }),
240246 });
241}
247});
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.ts+6-15
......@@ -12,17 +12,14 @@ import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
1212import * as EffectAcpErrors from "effect-acp/errors";
1313import { xAiRateLimitedErrorCode } from "@t3tools/provider-grok/testing";
1414import { assert, describe, it } from "@effect/vitest";
15import * as Crypto from "effect/Crypto";
1615import * as DateTime from "effect/DateTime";
1716import * as Effect from "effect/Effect";
18import * as FileSystem from "effect/FileSystem";
1917import * as Layer from "effect/Layer";
2018import * as PlatformError from "effect/PlatformError";
2119import * as Schema from "effect/Schema";
2220import { ChildProcessSpawner } from "effect/process";
2321import type * as EffectAcpSchema from "effect-acp/compat";
2422
25import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
2623import { layerTestProviderHost } from "@t3tools/provider-testing/host";
2724import * as ProjectStore from "../ProjectStore.ts";
2825import { buildInitialGrokProviderSnapshot } from "@t3tools/provider-grok/testing";
......@@ -42,7 +39,6 @@ import {
4239 makeGrokAcpAdapterFlavor,
4340 makeGrokAdapterV2,
4441 GrokProviderCapabilitiesV2,
45 type GrokAdapterV2Options,
4642} from "@t3tools/provider-grok/testing";
4743
4844const LAUNCH_TEST_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({
......@@ -99,7 +95,7 @@ describe("GrokAdapterV2 capabilities", () => {
9995 it("preserves Grok's rate-limit stop and distinguishes other prompt failures", () => {
10096 const flavor = makeGrokAcpAdapterFlavor({
10197 makeRuntime: () => Effect.never,
102 } as unknown as GrokAdapterV2Options);
98 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
10399 const limit = flavor.promptFailure?.(
104100 new EffectAcpErrors.AcpRequestError({
105101 code: xAiRateLimitedErrorCode,
......@@ -127,7 +123,7 @@ describe("GrokAdapterV2 capabilities", () => {
127123 it("wires hard Stop teardown but soft non-Stop interrupts in the constructor flavor", () => {
128124 const flavor = makeGrokAcpAdapterFlavor({
129125 makeRuntime: () => Effect.never,
130 } as unknown as GrokAdapterV2Options);
126 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
131127
132128 assert.isFalse(flavor.interruptPromptOnCancel);
133129 // User Stop (requestRuntimeRestart) keeps the hard process-group kill and
......@@ -144,7 +140,7 @@ describe("GrokAdapterV2 capabilities", () => {
144140 it("terminalizes only foreground tools under the actual Grok flavor", () => {
145141 const flavor = makeGrokAcpAdapterFlavor({
146142 makeRuntime: () => Effect.never,
147 } as unknown as GrokAdapterV2Options);
143 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
148144 const foreground = {
149145 toolCallId: "foreground-1",
150146 title: "Terminal",
......@@ -289,7 +285,7 @@ describe("ACP permission policy", () => {
289285describe("Grok permission prompts", () => {
290286 const disposition = makeGrokAcpAdapterFlavor({
291287 makeRuntime: () => Effect.never,
292 } as unknown as GrokAdapterV2Options).permissionDisposition;
288 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]).permissionDisposition;
293289
294290 // grok_auto_blocked_command replays Auto end to end. When an explicit policy
295291 // launches Grok asking instead, T3's policy still answers its prompts.
......@@ -332,18 +328,13 @@ describe("Grok launch permission mode", () => {
332328 );
333329 });
334330 const instanceId = ProviderInstanceId.make("grok-launch-test");
335 const adapter = makeGrokAdapterV2({
331 const adapter = yield* makeGrokAdapterV2({
336332 instanceId,
337333 settings: LAUNCH_TEST_GROK_SETTINGS,
338334 environment: {},
339335 hostPlatform: "darwin",
340 childProcessSpawner,
341 crypto: yield* Crypto.Crypto,
342 fileSystem: yield* FileSystem.FileSystem,
343 idAllocator: yield* IdAllocator.IdAllocatorV2,
344 host: yield* ProviderHost.ProviderHost,
345336 selfInvocation: yield* resolveSelfInvocation(),
346 });
337 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, childProcessSpawner));
347338 yield* adapter
348339 .openSession({
349340 threadId: ThreadId.make("grok-launch-test"),
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.testkit.ts+1-11
......@@ -1,7 +1,6 @@
11import * as NodeServices from "@effect/platform-node/NodeServices";
22import { GrokSettings } from "@t3tools/provider-grok/settings";
33import * as Effect from "effect/Effect";
4import * as Crypto from "effect/Crypto";
54import * as FileSystem from "effect/FileSystem";
65import * as Layer from "effect/Layer";
76import * as Path from "effect/Path";
......@@ -10,7 +9,6 @@ import { ChildProcessSpawner } from "effect/process";
109import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
1110import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
1211
13import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
1412import { layerTestProviderHost } from "@t3tools/provider-testing/host";
1513import { GROK_ACP_CANCEL_META, GROK_ACP_INITIALIZE_META } from "@t3tools/provider-grok/testing";
1614import { makeXAiPromptCompletionRuntime } from "@t3tools/provider-grok/testing";
......@@ -45,10 +43,7 @@ function layerGrokProviderAdapterRegistryReplay(
4543 const fileSystem = yield* FileSystem.FileSystem;
4644 const path = yield* Path.Path;
4745 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
48 const crypto = yield* Crypto.Crypto;
4946 const hostPlatform = yield* HostProcessPlatform;
50 const idAllocator = yield* IdAllocator.IdAllocatorV2;
51 const host = yield* ProviderHost.ProviderHost;
5247 // Same queue the continuation worker drains when the fixture runs it.
5348 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
5449 const replayGate = options.replayGate;
......@@ -61,16 +56,11 @@ function layerGrokProviderAdapterRegistryReplay(
6156 const scriptPath = yield* path
6257 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))
6358 .pipe(Effect.orDie);
64 const adapter = makeGrokAdapterV2({
59 const adapter = yield* makeGrokAdapterV2({
6560 instanceId: GROK_DEFAULT_INSTANCE_ID,
6661 settings: DEFAULT_GROK_SETTINGS,
6762 environment: {},
6863 hostPlatform,
69 childProcessSpawner,
70 crypto,
71 fileSystem,
72 idAllocator,
73 host,
7464 selfInvocation: yield* resolveSelfInvocation(),
7565 // Same wrapping as makeGrokAcpRuntime: client type and Ctrl+C cancel
7666 // metadata and the x.ai prompt-completion race, so replay sends what
apps/server/src/orchestration-v2/Adapters/MuseAdapterV2.testkit.ts+1-6
......@@ -24,11 +24,9 @@ import {
2424} from "@t3tools/contracts";
2525import { MuseSettings } from "@t3tools/provider-muse/settings";
2626import * as Effect from "effect/Effect";
27import * as FileSystem from "effect/FileSystem";
2827import * as Layer from "effect/Layer";
2928import * as Schema from "effect/Schema";
3029
31import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
3230import { layerTestProviderHost } from "@t3tools/provider-testing/host";
3331import {
3432 museInitializeParams,
......@@ -449,13 +447,10 @@ export function layer(input: {
449447 return ProviderAdapterRegistry.layerFromAdaptersEffect(
450448 Effect.gen(function* () {
451449 return [
452 makeMuseAdapterV2({
450 yield* makeMuseAdapterV2({
453451 instanceId: ProviderInstanceId.make(MUSE_PROVIDER_KIND),
454452 settings: DEFAULT_MUSE_SETTINGS,
455453 environment: input.environment ?? {},
456 idAllocator: yield* IdAllocator.IdAllocatorV2,
457 host: yield* ProviderHost,
458 fileSystem: yield* FileSystem.FileSystem,
459454 createHost: input.createHost,
460455 // Same queue the continuation worker drains when the fixture runs it.
461456 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,
apps/server/src/provider/Drivers/AntigravityDriver.ts+1-7
......@@ -94,7 +94,6 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
9494 const installation = yield* AntigravityInstallation.AntigravityInstallation;
9595 const loggers = yield* ProviderEventLoggers.ProviderEventLoggers;
9696 const modelManifest = yield* ModelManifest.ModelManifest;
97 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9897 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
9998 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
10099 const settings = { ...config, enabled } satisfies AntigravitySettings;
......@@ -397,13 +396,8 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
397396 const defaultModel = modelManifest.current.pipe(
398397 Effect.map((manifest) => ModelManifest.manifestDefaultModel(manifest, DRIVER)),
399398 );
400 const orchestrationAdapter = makeAntigravityAdapterV2({
399 const orchestrationAdapter = yield* makeAntigravityAdapterV2({
401400 instanceId,
402 crypto,
403 fileSystem,
404 path,
405 idAllocator,
406 host,
407401 selfInvocation,
408402 makeRuntime,
409403 withProcess: authFlow.withProcess,
packages/provider-acp/src/server/adapter.ts+12-13
......@@ -1,5 +1,4 @@
11// @effect-diagnostics nodeBuiltinImport:off
2import * as NodePath from "node:path";
32
43import {
54 type ChatAttachment,
......@@ -57,7 +56,7 @@ import type * as EffectAcpProtocol from "effect-acp/protocol";
5756import type * as EffectAcpSchema from "effect-acp/compat";
5857
5958import { formatReadToolLabel, formatSearchToolLabel } from "@t3tools/shared/toolActivity";
60import type * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
59import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
6160import { makeAcpMcpOverAcpBridge, type AcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
6261import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation";
6362import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
......@@ -480,10 +479,6 @@ export interface AcpAdapterV2SubagentUpdate {
480479export interface AcpAdapterV2Options {
481480 readonly instanceId: ProviderInstanceId;
482481 readonly flavor: AcpAdapterV2Flavor;
483 readonly crypto: Crypto.Crypto;
484 readonly fileSystem: FileSystem.FileSystem;
485 readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
486 readonly host: ProviderHost.ProviderHostShape;
487482 /** How agents spawn this install's `acp-mcp-bridge`; see `resolveSelfInvocation`. */
488483 readonly selfInvocation: SelfInvocation;
489484 /**
......@@ -1490,10 +1485,14 @@ function shouldPersistToolUpdate(
14901485 return persist;
14911486}
14921487
1493export function makeAcpAdapterV2(
1488export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
14941489 options: AcpAdapterV2Options,
1495): ProviderAdapter.ProviderAdapterV2Shape {
1496 const { flavor, fileSystem, idAllocator, host, selfInvocation: self } = options;
1490) {
1491 const crypto = yield* Crypto.Crypto;
1492 const fileSystem = yield* FileSystem.FileSystem;
1493 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1494 const host = yield* ProviderHost.ProviderHost;
1495 const { flavor, selfInvocation: self } = options;
14971496 const driver = flavor.driver;
14981497 const continuationRequests = options.continuationRequests;
14991498 const postSettleContinuationEnabled =
......@@ -5999,7 +5998,7 @@ export function makeAcpAdapterV2(
59995998 const mcpBridge = yield* makeAcpMcpOverAcpBridge({
60005999 endpoint: mcpContext.endpoint,
60016000 authorization: mcpContext.authorization,
6002 allocateConnectionId: options.crypto.randomUUIDv4.pipe(Effect.orDie),
6001 allocateConnectionId: crypto.randomUUIDv4.pipe(Effect.orDie),
60036002 });
60046003 yield* Scope.addFinalizer(scope, mcpBridge.dispose);
60056004 return mcpBridge;
......@@ -6019,7 +6018,7 @@ export function makeAcpAdapterV2(
60196018 .makeRuntime(makeRuntimeInput(runtimeGeneration, threadId, resumeSessionId))
60206019 .pipe(
60216020 Effect.provideService(Scope.Scope, runtimeScope),
6022 Effect.provideService(Crypto.Crypto, options.crypto),
6021 Effect.provideService(Crypto.Crypto, crypto),
60236022 );
60246023 });
60256024
......@@ -6096,7 +6095,7 @@ export function makeAcpAdapterV2(
60966095 )
60976096 .pipe(
60986097 Effect.provideService(Scope.Scope, replacementScope),
6099 Effect.provideService(Crypto.Crypto, options.crypto),
6098 Effect.provideService(Crypto.Crypto, crypto),
61006099 );
61016100 // Session setup may publish commands before it returns. Buffer those
61026101 // notifications, but do not expose request or extension handlers
......@@ -8049,6 +8048,6 @@ export function makeAcpAdapterV2(
80498048 ),
80508049 ),
80518050 });
8052}
8051});
80538052
80548053export type AcpAdapterV2Env = FileSystem.FileSystem | IdAllocator.IdAllocatorV2;
packages/provider-core/src/server/ProviderHost.ts+2-2
......@@ -45,7 +45,7 @@ export interface ProviderCredentials {
4545 readonly remove: Effect.Effect<void, ProviderCredentialError>;
4646}
4747
48export interface ProviderHostShape {
48interface ProviderHostService {
4949 readonly paths: ProviderHostPaths;
5050 readonly settings: {
5151 readonly get: Effect.Effect<ServerSettings, ServerSettingsError>;
......@@ -68,6 +68,6 @@ export interface ProviderHostShape {
6868 ) => Effect.Effect<ProviderCredentials>;
6969}
7070
71export class ProviderHost extends Context.Service<ProviderHost, ProviderHostShape>()(
71export class ProviderHost extends Context.Service<ProviderHost, ProviderHostService>()(
7272 "@t3tools/provider-core/server/ProviderHost",
7373) {}
packages/provider-core/src/server/managedProvider.test.ts+2-2
......@@ -99,7 +99,7 @@ const refreshedSnapshotSecond: ServerProvider = {
9999/** A host whose settings never change and whose background demand is fixed. */
100100function layerProviderHost(input: {
101101 readonly runBackgroundWork: boolean;
102 readonly settings?: Pick<ProviderHost.ProviderHostShape, "settings">["settings"];
102 readonly settings?: Pick<ProviderHost.ProviderHost["Service"], "settings">["settings"];
103103}) {
104104 return Layer.succeed(
105105 ProviderHost.ProviderHost,
......@@ -283,7 +283,7 @@ describe("makeManagedServerProvider", () => {
283283 };
284284 const serverSettingsRef = yield* Ref.make(initialServerSettings);
285285 const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>();
286 const hostSettings: ProviderHost.ProviderHostShape["settings"] = {
286 const hostSettings: ProviderHost.ProviderHost["Service"]["settings"] = {
287287 get: Ref.get(serverSettingsRef),
288288 changes: Stream.empty,
289289 subscribe: PubSub.subscribe(serverSettingsChanges).pipe(
packages/provider-core/src/server/snapshotSettings.ts+1-1
......@@ -29,7 +29,7 @@ export function haveProviderSnapshotSettingsChanged<Settings>(
2929
3030export function makeProviderSnapshotSettingsSource<Settings>(
3131 provider: Settings,
32 settings: ProviderHost.ProviderHostShape["settings"],
32 settings: ProviderHost.ProviderHost["Service"]["settings"],
3333): {
3434 readonly getSettings: Effect.Effect<ProviderSnapshotSettings<Settings>, ServerSettingsError>;
3535 readonly streamSettings: Stream.Stream<ProviderSnapshotSettings<Settings>>;
packages/provider-cursor/src/server/adapter.test.ts+18-33
......@@ -22,7 +22,6 @@ import * as Path from "effect/Path";
2222import * as Schema from "effect/Schema";
2323import * as Stream from "effect/Stream";
2424
25import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
2625import { layerTestProviderHost } from "@t3tools/provider-testing/host";
2726import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
2827import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
......@@ -51,7 +50,6 @@ describe("CursorAdapterV2", () => {
5150 ({ status, model, lateModel }) =>
5251 Effect.gen(function* () {
5352 const fileSystem = yield* FileSystem.FileSystem;
54 const path = yield* Path.Path;
5553 const workspace = yield* fileSystem.makeTempDirectoryScoped({
5654 prefix: "cursor-v2-lifecycle-",
5755 });
......@@ -63,17 +61,12 @@ describe("CursorAdapterV2", () => {
6361 interactionMode: "default",
6462 cwd: workspace,
6563 });
66 const adapter = makeCursorAdapterV2({
64 const adapter = yield* makeCursorAdapterV2({
6765 instanceId,
6866 settings: yield* decodeCursorSettings({}),
6967 environment: { HOME: workspace },
70 fileSystem,
71 path,
72 idAllocator: yield* IdAllocator.IdAllocatorV2,
73 host: yield* ProviderHost.ProviderHost.pipe(
74 Effect.provide(layerTestProviderHost({ cwd: workspace })),
75 ),
76 runner: {
68 }).pipe(
69 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
7770 assertComplete: Effect.void,
7871 open: () =>
7972 Effect.succeed({
......@@ -131,8 +124,9 @@ describe("CursorAdapterV2", () => {
131124 };
132125 }),
133126 }),
134 },
135 });
127 }),
128 Effect.provide(layerTestProviderHost({ cwd: workspace })),
129 );
136130 const runtime = yield* adapter.openSession({
137131 threadId,
138132 providerSessionId: ProviderSessionId.make("cursor-lifecycle-session"),
......@@ -211,7 +205,6 @@ describe("CursorAdapterV2", () => {
211205 it.effect("fails standalone SDK transport diagnostics and sends compaction as /compress", () =>
212206 Effect.gen(function* () {
213207 const fileSystem = yield* FileSystem.FileSystem;
214 const path = yield* Path.Path;
215208 const workspace = yield* fileSystem.makeTempDirectoryScoped({ prefix: "cursor-v2-errors-" });
216209 const sentMessages: Array<string> = [];
217210 let sendCalls = 0;
......@@ -223,17 +216,12 @@ describe("CursorAdapterV2", () => {
223216 interactionMode: "default",
224217 cwd: workspace,
225218 });
226 const adapter = makeCursorAdapterV2({
219 const adapter = yield* makeCursorAdapterV2({
227220 instanceId,
228221 settings: yield* decodeCursorSettings({}),
229222 environment: { HOME: workspace },
230 fileSystem,
231 path,
232 idAllocator: yield* IdAllocator.IdAllocatorV2,
233 host: yield* ProviderHost.ProviderHost.pipe(
234 Effect.provide(layerTestProviderHost({ cwd: workspace })),
235 ),
236 runner: {
223 }).pipe(
224 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
237225 assertComplete: Effect.void,
238226 open: () =>
239227 Effect.succeed({
......@@ -264,8 +252,9 @@ describe("CursorAdapterV2", () => {
264252 };
265253 }),
266254 }),
267 },
268 });
255 }),
256 Effect.provide(layerTestProviderHost({ cwd: workspace })),
257 );
269258 const runtime = yield* adapter.openSession({
270259 threadId,
271260 providerSessionId: ProviderSessionId.make("cursor-error-session"),
......@@ -564,17 +553,12 @@ describe("CursorAdapterV2", () => {
564553 },
565554 },
566555 ];
567 const adapter = makeCursorAdapterV2({
556 const adapter = yield* makeCursorAdapterV2({
568557 instanceId,
569558 settings: yield* decodeCursorSettings({}),
570559 environment: { HOME: workspace },
571 fileSystem,
572 path,
573 idAllocator: yield* IdAllocator.IdAllocatorV2,
574 host: yield* ProviderHost.ProviderHost.pipe(
575 Effect.provide(layerTestProviderHost({ cwd: workspace })),
576 ),
577 runner: {
560 }).pipe(
561 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
578562 assertComplete: Effect.void,
579563 open: () =>
580564 Effect.succeed({
......@@ -602,8 +586,9 @@ describe("CursorAdapterV2", () => {
602586 };
603587 }),
604588 }),
605 },
606 });
589 }),
590 Effect.provide(layerTestProviderHost({ cwd: workspace })),
591 );
607592 const runtime = yield* adapter.openSession({
608593 threadId,
609594 providerSessionId: ProviderSessionId.make("cursor-search-session"),
packages/provider-cursor/src/server/adapter.ts+12-32
......@@ -844,17 +844,17 @@ export interface CursorAdapterV2Options {
844844 readonly instanceId: ProviderInstanceId;
845845 readonly settings: CursorSettings;
846846 readonly environment: NodeJS.ProcessEnv;
847 readonly fileSystem: FileSystem.FileSystem;
848 readonly path: Path.Path;
849 readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
850 readonly runner: CursorAgentSdk.CursorAgentSdkRunnerShape;
851 readonly host: ProviderHost.ProviderHostShape;
852847}
853848
854export function makeCursorAdapterV2(
855 adapterOptions: CursorAdapterV2Options,
856): ProviderAdapter.ProviderAdapterV2Shape {
857 const { fileSystem, path, idAllocator, runner, host } = adapterOptions;
849export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
850 options: CursorAdapterV2Options,
851) {
852 const fileSystem = yield* FileSystem.FileSystem;
853 const path = yield* Path.Path;
854 const idAllocator = yield* IdAllocator.IdAllocatorV2;
855 const runner = yield* CursorAgentSdk.CursorAgentSdkRunner;
856 const host = yield* ProviderHost.ProviderHost;
857 const adapterOptions = options;
858858 const apiKey = adapterOptions.environment.CURSOR_API_KEY?.trim() || undefined;
859859
860860 return ProviderAdapter.ProviderAdapterV2.of({
......@@ -2596,7 +2596,7 @@ export function makeCursorAdapterV2(
25962596 ),
25972597 ),
25982598 });
2599}
2599});
26002600
26012601export type CursorAdapterV2DriverEnv =
26022602 | CursorAgentSdk.CursorAgentSdkRunner
......@@ -2615,23 +2615,13 @@ export const CursorAdapterV2Driver: ProviderAdapterDriver<
26152615 create: Effect.fn("CursorAdapterV2Driver.create")(
26162616 function* (input: ProviderAdapterDriverCreateInput<CursorSettings>) {
26172617 const hostEnvironment = yield* HostProcessEnvironment;
2618 const fileSystem = yield* FileSystem.FileSystem;
2619 const path = yield* Path.Path;
2620 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2621 const runner = yield* CursorAgentSdk.CursorAgentSdkRunner;
2622 const host = yield* ProviderHost.ProviderHost;
2623 return makeCursorAdapterV2({
2618 return yield* makeCursorAdapterV2({
26242619 instanceId: input.instanceId,
26252620 settings: {
26262621 ...input.config,
26272622 enabled: input.enabled,
26282623 },
26292624 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
2630 fileSystem,
2631 path,
2632 idAllocator,
2633 runner,
2634 host,
26352625 });
26362626 },
26372627 (effect, input) =>
......@@ -2661,20 +2651,10 @@ const layer: Layer.Layer<
26612651 ProviderAdapter.ProviderAdapterV2,
26622652 Effect.gen(function* () {
26632653 const hostEnvironment = yield* HostProcessEnvironment;
2664 const fileSystem = yield* FileSystem.FileSystem;
2665 const path = yield* Path.Path;
2666 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2667 const runner = yield* CursorAgentSdk.CursorAgentSdkRunner;
2668 const host = yield* ProviderHost.ProviderHost;
2669 return makeCursorAdapterV2({
2654 return yield* makeCursorAdapterV2({
26702655 instanceId: CURSOR_DEFAULT_INSTANCE_ID,
26712656 settings: DEFAULT_CURSOR_SETTINGS,
26722657 environment: hostEnvironment,
2673 fileSystem,
2674 path,
2675 idAllocator,
2676 runner,
2677 host,
26782658 });
26792659 }),
26802660);
packages/provider-cursor/src/server/credentialStore.test.ts-1
......@@ -4,7 +4,6 @@ import { ProviderInstanceId } from "@t3tools/contracts";
44import * as Effect from "effect/Effect";
55import * as FileSystem from "effect/FileSystem";
66import * as Path from "effect/Path";
7import * as Option from "effect/Option";
87
98import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
109import { layerTestProviderHost } from "@t3tools/provider-testing/host";
packages/provider-grok/src/server/adapter.ts+15-36
......@@ -112,12 +112,7 @@ export interface GrokAdapterV2Options {
112112 readonly settings: GrokSettings;
113113 readonly environment: NodeJS.ProcessEnv;
114114 readonly hostPlatform: NodeJS.Platform;
115 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
116 readonly crypto: Crypto.Crypto;
117115 readonly selfInvocation: SelfInvocation;
118 readonly fileSystem: FileSystem.FileSystem;
119 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
120 readonly host: ProviderHost.ProviderHostShape;
121116 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
122117 readonly continuationRequests?: Parameters<typeof makeAcpAdapterV2>[0]["continuationRequests"];
123118 readonly testHooks?: Parameters<typeof makeAcpAdapterV2>[0]["testHooks"];
......@@ -229,7 +224,12 @@ export function grokLaunchRuntimeMode(
229224 : "approval-required";
230225}
231226
232export function makeGrokAcpAdapterFlavor(options: GrokAdapterV2Options): AcpAdapterV2Flavor {
227/** The flavor runs Grok's launcher through the adapter's spawner. */
228export function makeGrokAcpAdapterFlavor(
229 options: GrokAdapterV2Options & {
230 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
231 },
232): AcpAdapterV2Flavor {
233233 return {
234234 driver: GROK_PROVIDER,
235235 runtimeHarness: "Grok",
......@@ -329,15 +329,14 @@ export function makeGrokAcpAdapterFlavor(options: GrokAdapterV2Options): AcpAdap
329329 };
330330}
331331
332export function makeGrokAdapterV2(options: GrokAdapterV2Options) {
333 const flavor = makeGrokAcpAdapterFlavor(options);
334 return makeAcpAdapterV2({
332export const makeGrokAdapterV2 = Effect.fn("makeGrokAdapterV2")(function* (
333 options: GrokAdapterV2Options,
334) {
335 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
336 const flavor = makeGrokAcpAdapterFlavor({ ...options, childProcessSpawner });
337 return yield* makeAcpAdapterV2({
335338 instanceId: options.instanceId,
336339 flavor,
337 crypto: options.crypto,
338 fileSystem: options.fileSystem,
339 idAllocator: options.idAllocator,
340 host: options.host,
341340 selfInvocation: options.selfInvocation,
342341 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
343342 ...(options.continuationRequests === undefined
......@@ -345,7 +344,7 @@ export function makeGrokAdapterV2(options: GrokAdapterV2Options) {
345344 : { continuationRequests: options.continuationRequests }),
346345 ...(options.testHooks === undefined ? {} : { testHooks: options.testHooks }),
347346 });
348}
347});
349348
350349export type GrokAdapterV2DriverEnv =
351350 | ChildProcessSpawner.ChildProcessSpawner
......@@ -365,24 +364,14 @@ export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapte
365364 const hostEnvironment = yield* HostProcessEnvironment;
366365 const hostPlatform = yield* HostProcessPlatform;
367366 const selfInvocation = yield* resolveSelfInvocation();
368 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
369 const crypto = yield* Crypto.Crypto;
370 const fileSystem = yield* FileSystem.FileSystem;
371 const idAllocator = yield* IdAllocator.IdAllocatorV2;
372367 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
373 const host = yield* ProviderHost.ProviderHost;
374368 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
375369 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
376 return makeGrokAdapterV2({
370 return yield* makeGrokAdapterV2({
377371 instanceId: input.instanceId,
378372 settings: { ...input.config, enabled: input.enabled },
379373 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
380374 hostPlatform,
381 childProcessSpawner,
382 crypto,
383 fileSystem,
384 idAllocator,
385 host,
386375 selfInvocation,
387376 continuationRequests,
388377 nativeLogging: (threadId) =>
......@@ -424,24 +413,14 @@ const layer: Layer.Layer<
424413 const hostEnvironment = yield* HostProcessEnvironment;
425414 const hostPlatform = yield* HostProcessPlatform;
426415 const selfInvocation = yield* resolveSelfInvocation();
427 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
428 const crypto = yield* Crypto.Crypto;
429 const fileSystem = yield* FileSystem.FileSystem;
430 const idAllocator = yield* IdAllocator.IdAllocatorV2;
431416 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
432 const host = yield* ProviderHost.ProviderHost;
433417 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
434418 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
435 return makeGrokAdapterV2({
419 return yield* makeGrokAdapterV2({
436420 instanceId: GROK_DEFAULT_INSTANCE_ID,
437421 settings: DEFAULT_GROK_SETTINGS,
438422 environment: hostEnvironment,
439423 hostPlatform,
440 childProcessSpawner,
441 crypto,
442 fileSystem,
443 idAllocator,
444 host,
445424 selfInvocation,
446425 continuationRequests,
447426 nativeLogging: (threadId) =>
packages/provider-muse/src/server/adapter.test.ts+2-10
......@@ -24,14 +24,12 @@ import * as Deferred from "effect/Deferred";
2424import * as Effect from "effect/Effect";
2525import * as Option from "effect/Option";
2626import type * as Exit from "effect/Exit";
27import * as FileSystem from "effect/FileSystem";
2827import * as Fiber from "effect/Fiber";
2928import * as Layer from "effect/Layer";
3029import * as Queue from "effect/Queue";
3130import * as Schema from "effect/Schema";
3231import * as Stream from "effect/Stream";
3332
34import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
3533import { layerTestProviderHost } from "@t3tools/provider-testing/host";
3634import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
3735import type { MuseItem } from "./protocol.ts";
......@@ -195,13 +193,10 @@ const makeHarness = Effect.fnUntraced(function* (
195193 > = {},
196194) {
197195 let hostCount = 0;
198 const adapter = makeMuseAdapterV2({
196 const adapter = yield* makeMuseAdapterV2({
199197 instanceId,
200198 settings: museSettings,
201199 environment: { PATH: "/fake/bin" },
202 idAllocator: yield* IdAllocator.IdAllocatorV2,
203 host: yield* ProviderHost.ProviderHost,
204 fileSystem: yield* FileSystem.FileSystem,
205200 createHost: async () => (hostCount++ === 0 ? fake.host : (replacement ?? fake).host),
206201 ...overrides,
207202 });
......@@ -434,13 +429,10 @@ describe("MuseAdapterV2", () => {
434429 for (const kind of ["sessionNotFound", "notFound"] as const) {
435430 const fake = yield* makeFakeMuse();
436431 const allocated = yield* preallocatedProviderThread();
437 const adapter = makeMuseAdapterV2({
432 const adapter = yield* makeMuseAdapterV2({
438433 instanceId: INSTANCE_ID,
439434 settings: museSettings,
440435 environment: { PATH: "/fake/bin" },
441 idAllocator: yield* IdAllocator.IdAllocatorV2,
442 host: yield* ProviderHost.ProviderHost,
443 fileSystem: yield* FileSystem.FileSystem,
444436 createHost: async () => fake.host,
445437 });
446438 const runtime = yield* adapter.openSession({
packages/provider-muse/src/server/adapter.ts+13-13
......@@ -35,7 +35,7 @@ import * as Semaphore from "effect/Semaphore";
3535import * as Scope from "effect/Scope";
3636import * as Stream from "effect/Stream";
3737
38import type * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
38import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
3939import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
4040import { buildRuntimeInstructions } from "@t3tools/provider-core/server/runtimeInstructions";
4141import { museModelCapabilities, resolveMuseReasoningEffort } from "./modelCatalog.ts";
......@@ -181,9 +181,6 @@ export interface MuseAdapterV2Options {
181181 readonly instanceId: ProviderInstanceId;
182182 readonly settings: MuseSettings;
183183 readonly environment: NodeJS.ProcessEnv;
184 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
185 readonly host: ProviderHost.ProviderHostShape;
186 readonly fileSystem: FileSystem.FileSystem;
187184 readonly modelCatalog?: Effect.Effect<ReadonlyArray<ServerProviderModel>>;
188185 readonly createHost?: typeof createMuseSdkHost;
189186 readonly requestTimeoutMs?: number;
......@@ -245,10 +242,13 @@ const TOOLS_WITH_NATIVE_ROWS = new Set(["write_todos", "request_user_input", "wo
245242const responseAnswerSchema = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
246243
247244/** One scoped Muse host owns one native session; the orchestrator owns app runs and queuing. */
248export function makeMuseAdapterV2(
245export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* (
249246 options: MuseAdapterV2Options,
250): ProviderAdapter.ProviderAdapterV2Shape {
251 const { idAllocator } = options;
247) {
248 const idAllocator = yield* IdAllocator.IdAllocatorV2;
249 const providerHost = yield* ProviderHost.ProviderHost;
250 const fileSystem = yield* FileSystem.FileSystem;
251
252252 const protocolError = (detail: string, payload?: unknown) =>
253253 new ProviderAdapter.ProviderAdapterProtocolError({
254254 driver: MUSE_PROVIDER,
......@@ -269,8 +269,8 @@ export function makeMuseAdapterV2(
269269 const scope = yield* Effect.scope;
270270 // Muse rejects non-canonical workspace roots (for example macOS /tmp) and
271271 // reports canonical paths in approvals, so resolve symlinks once here.
272 const requestedCwd = input.runtimePolicy.cwd ?? options.host.paths.cwd;
273 const cwd = yield* options.fileSystem
272 const requestedCwd = input.runtimePolicy.cwd ?? providerHost.paths.cwd;
273 const cwd = yield* fileSystem
274274 .realPath(requestedCwd)
275275 .pipe(Effect.orElseSucceed(() => requestedCwd));
276276 const now = yield* DateTime.now;
......@@ -1581,14 +1581,14 @@ export function makeMuseAdapterV2(
15811581 const text = providerMessageTextWithAttachmentPaths({
15821582 text: message.text,
15831583 attachments: message.attachments,
1584 resolveAttachmentPath: options.host.resolveAttachmentPath,
1584 resolveAttachmentPath: providerHost.resolveAttachmentPath,
15851585 });
15861586 if (text) parts.push({ type: "text", text });
15871587 for (const attachment of message.attachments)
15881588 if (isProviderNativeImageAttachment(attachment)) {
1589 const path = options.host.resolveAttachmentPath(attachment);
1589 const path = providerHost.resolveAttachmentPath(attachment);
15901590 if (!path) return yield* protocolError("Muse image attachment is missing");
1591 const bytes = yield* options.fileSystem
1591 const bytes = yield* fileSystem
15921592 .readFile(path)
15931593 .pipe(Effect.mapError((cause) => protocolError("Cannot read Muse image", cause)));
15941594 parts.push({
......@@ -2031,4 +2031,4 @@ export function makeMuseAdapterV2(
20312031 return runtime;
20322032 }),
20332033 });
2034}
2034});
packages/provider-muse/src/server/driver.ts+1-5
......@@ -63,7 +63,6 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = {
6363 const host = yield* ProviderHost.ProviderHost;
6464 const eventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
6565 const { cwd } = host.paths;
66 const idAllocator = yield* IdAllocator.IdAllocatorV2;
6766 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
6867 const hostEnvironment = yield* HostProcessEnvironment;
6968 // Drop an inherited META_API_KEY so Muse uses its login; an instance value still wins.
......@@ -148,13 +147,10 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = {
148147 ),
149148 );
150149 const modelCatalog = snapshot.getSnapshot.pipe(Effect.map((current) => current.models));
151 const orchestrationAdapter = makeMuseAdapterV2({
150 const orchestrationAdapter = yield* makeMuseAdapterV2({
152151 instanceId,
153152 settings: effectiveConfig,
154153 environment: processEnvironment,
155 idAllocator,
156 host,
157 fileSystem,
158154 modelCatalog,
159155 ...(eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}),
160156 continuationRequests,
packages/provider-opencode/src/server/adapter.test.ts+24-32
......@@ -34,7 +34,7 @@ import * as TestClock from "effect/testing/TestClock";
3434import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
3535import { layerTestProviderHost } from "@t3tools/provider-testing/host";
3636import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
37import type * as OpenCodeRuntime from "./OpenCodeRuntime.ts";
37import * as OpenCodeRuntime from "./OpenCodeRuntime.ts";
3838import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
3939
4040import {
......@@ -148,7 +148,6 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
148148 nativeSessionId: string,
149149 client: object,
150150) {
151 const idAllocator = yield* IdAllocator.IdAllocatorV2;
152151 const instanceId = ProviderInstanceId.make(`opencode-${suffix}`);
153152 const threadId = ThreadId.make(`thread-opencode-${suffix}`);
154153 const modelSelection = {
......@@ -157,20 +156,20 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
157156 options: [],
158157 };
159158 const policy = runtimePolicy("full-access", { cwd: "/workspace" });
160 const adapter = makeOpenCodeAdapterV2({
159 const adapter = yield* makeOpenCodeAdapterV2({
161160 instanceId,
162161 settings: OPEN_CODE_TEST_SETTINGS,
163162 environment: {},
164 runtime: {
163 }).pipe(
164 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
165165 connectToOpenCodeServer: () => Effect.succeed({ url: "http://test.invalid", external: true }),
166166 createOpenCodeSdkClient: () => client,
167 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,
168 idAllocator,
169 host: {
167 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
168 Effect.provideService(ProviderHost.ProviderHost, {
170169 paths: { cwd: "/workspace" },
171170 resolveAttachmentPath: () => null,
172 } as unknown as ProviderHost.ProviderHostShape,
173 });
171 } as unknown as ProviderHost.ProviderHost["Service"]),
172 );
174173 const runtime = yield* adapter.openSession({
175174 threadId,
176175 providerSessionId: ProviderSessionId.make(`session-opencode-${suffix}`),
......@@ -1421,7 +1420,6 @@ describe("OpenCodeAdapterV2", () => {
14211420
14221421 it.effect("keeps a newly admitted prompt alive across stale idle and delayed busy evidence", () =>
14231422 Effect.gen(function* () {
1424 const idAllocator = yield* IdAllocator.IdAllocatorV2;
14251423 const nativeEvents = asyncEventStream();
14261424 const prompt = promiseGate<void>();
14271425 const promptStarted = promiseGate<void>();
......@@ -1488,21 +1486,21 @@ describe("OpenCodeAdapterV2", () => {
14881486 },
14891487 mcp: { add: async () => ({ data: true }) },
14901488 };
1491 const adapter = makeOpenCodeAdapterV2({
1489 const adapter = yield* makeOpenCodeAdapterV2({
14921490 instanceId: ProviderInstanceId.make("opencode-test"),
14931491 settings: OPEN_CODE_TEST_SETTINGS,
14941492 environment: {},
1495 runtime: {
1493 }).pipe(
1494 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
14961495 connectToOpenCodeServer: () =>
14971496 Effect.succeed({ url: "http://test.invalid", external: true }),
14981497 createOpenCodeSdkClient: () => client,
1499 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,
1500 idAllocator,
1501 host: {
1498 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
1499 Effect.provideService(ProviderHost.ProviderHost, {
15021500 paths: { cwd: "/workspace" },
15031501 resolveAttachmentPath: () => null,
1504 } as unknown as ProviderHost.ProviderHostShape,
1505 });
1502 } as unknown as ProviderHost.ProviderHost["Service"]),
1503 );
15061504 const threadId = ThreadId.make("thread-opencode-admission-race");
15071505 const providerSessionId = ProviderSessionId.make("session-opencode-admission-race");
15081506 const modelSelection = {
......@@ -1739,7 +1737,6 @@ describe("OpenCodeAdapterV2", () => {
17391737
17401738 it.effect("interrupts an initial prompt while its SDK request is pending", () =>
17411739 Effect.gen(function* () {
1742 const idAllocator = yield* IdAllocator.IdAllocatorV2;
17431740 const nativeEvents = asyncEventStream();
17441741 const promptStarted = promiseGate<void>();
17451742 const abortCalled = promiseGate<void>();
......@@ -1783,21 +1780,21 @@ describe("OpenCodeAdapterV2", () => {
17831780 },
17841781 mcp: { add: async () => ({ data: true }) },
17851782 };
1786 const adapter = makeOpenCodeAdapterV2({
1783 const adapter = yield* makeOpenCodeAdapterV2({
17871784 instanceId: ProviderInstanceId.make("opencode-initial-stop-test"),
17881785 settings: OPEN_CODE_TEST_SETTINGS,
17891786 environment: {},
1790 runtime: {
1787 }).pipe(
1788 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
17911789 connectToOpenCodeServer: () =>
17921790 Effect.succeed({ url: "http://test.invalid", external: true }),
17931791 createOpenCodeSdkClient: () => client,
1794 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,
1795 idAllocator,
1796 host: {
1792 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
1793 Effect.provideService(ProviderHost.ProviderHost, {
17971794 paths: { cwd: "/workspace" },
17981795 resolveAttachmentPath: () => null,
1799 } as unknown as ProviderHost.ProviderHostShape,
1800 });
1796 } as unknown as ProviderHost.ProviderHost["Service"]),
1797 );
18011798 const threadId = ThreadId.make("thread-opencode-initial-stop");
18021799 const providerSessionId = ProviderSessionId.make("session-opencode-initial-stop");
18031800 const modelSelection = {
......@@ -2419,8 +2416,6 @@ describe("OpenCodeAdapterV2", () => {
24192416
24202417 it.effect("adopts the handed-over provider thread identity on session create", () =>
24212418 Effect.gen(function* () {
2422 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2423 const host = yield* ProviderHost.ProviderHost;
24242419 let createCount = 0;
24252420 const createInputs: Array<unknown> = [];
24262421 const fakeClient = {
......@@ -2467,14 +2462,11 @@ describe("OpenCodeAdapterV2", () => {
24672462 const instanceId = ProviderInstanceId.make("opencode");
24682463 const threadId = ThreadId.make("thread-opencode-adopt");
24692464 const modelSelection = { instanceId, model: "default" };
2470 const adapter = makeOpenCodeAdapterV2({
2465 const adapter = yield* makeOpenCodeAdapterV2({
24712466 instanceId,
24722467 settings: OPENCODE_TEST_SETTINGS,
24732468 environment: {},
2474 runtime,
2475 idAllocator,
2476 host,
2477 });
2469 }).pipe(Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, runtime));
24782470 const session = yield* adapter.openSession({
24792471 threadId,
24802472 providerSessionId: ProviderSessionId.make("provider-session-opencode-adopt"),
packages/provider-opencode/src/server/adapter.ts+8-21
......@@ -438,9 +438,6 @@ export interface OpenCodeAdapterV2Options {
438438 readonly instanceId: ProviderInstanceId;
439439 readonly settings: OpenCodeSettings;
440440 readonly environment: NodeJS.ProcessEnv;
441 readonly runtime: OpenCodeRuntime.OpenCodeRuntimeShape;
442 readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
443 readonly host: ProviderHost.ProviderHostShape;
444441 readonly nativeEventLogger?: ProviderEventLoggers.EventNdjsonLogger;
445442}
446443
......@@ -944,10 +941,12 @@ function unwrapData<A>(operation: string, result: { readonly data?: A }): NonNul
944941 return result.data as NonNullable<A>;
945942}
946943
947export function makeOpenCodeAdapterV2(
944export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function* (
948945 options: OpenCodeAdapterV2Options,
949): ProviderAdapter.ProviderAdapterV2Shape {
950 const { idAllocator, runtime, host } = options;
946) {
947 const runtime = yield* OpenCodeRuntime.OpenCodeRuntime;
948 const idAllocator = yield* IdAllocator.IdAllocatorV2;
949 const host = yield* ProviderHost.ProviderHost;
951950
952951 return ProviderAdapter.ProviderAdapterV2.of({
953952 instanceId: options.instanceId,
......@@ -3724,7 +3723,7 @@ export function makeOpenCodeAdapterV2(
37243723 ),
37253724 ),
37263725 });
3727}
3726});
37283727
37293728export type OpenCodeAdapterV2DriverEnv =
37303729 | OpenCodeRuntime.OpenCodeRuntime
......@@ -3742,17 +3741,11 @@ export const OpenCodeAdapterV2Driver: ProviderAdapterDriver<
37423741 create: Effect.fn("OpenCodeAdapterV2Driver.create")(
37433742 function* (input: ProviderAdapterDriverCreateInput<OpenCodeSettings>) {
37443743 const hostEnvironment = yield* HostProcessEnvironment;
3745 const openCodeRuntime = yield* OpenCodeRuntime.OpenCodeRuntime;
3746 const idAllocator = yield* IdAllocator.IdAllocatorV2;
37473744 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
3748 const host = yield* ProviderHost.ProviderHost;
3749 return makeOpenCodeAdapterV2({
3745 return yield* makeOpenCodeAdapterV2({
37503746 instanceId: input.instanceId,
37513747 settings: { ...input.config, enabled: input.enabled },
37523748 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
3753 runtime: openCodeRuntime,
3754 idAllocator,
3755 host,
37563749 ...(providerEventLoggers.native === undefined
37573750 ? {}
37583751 : { nativeEventLogger: providerEventLoggers.native }),
......@@ -3778,17 +3771,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, OpenCodeAdapt
37783771 ProviderAdapter.ProviderAdapterV2,
37793772 Effect.gen(function* () {
37803773 const hostEnvironment = yield* HostProcessEnvironment;
3781 const openCodeRuntime = yield* OpenCodeRuntime.OpenCodeRuntime;
3782 const idAllocator = yield* IdAllocator.IdAllocatorV2;
37833774 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
3784 const host = yield* ProviderHost.ProviderHost;
3785 return makeOpenCodeAdapterV2({
3775 return yield* makeOpenCodeAdapterV2({
37863776 instanceId: OPENCODE_DEFAULT_INSTANCE_ID,
37873777 settings: DEFAULT_OPENCODE_SETTINGS,
37883778 environment: hostEnvironment,
3789 runtime: openCodeRuntime,
3790 idAllocator,
3791 host,
37923779 ...(providerEventLoggers.native === undefined
37933780 ? {}
37943781 : { nativeEventLogger: providerEventLoggers.native }),
packages/provider-opencode/src/server/v2/textGeneration.ts+1-1
......@@ -40,7 +40,7 @@ type Outcome =
4040const runOnServer = (
4141 connection: OpenCode2Server.OpenCode2Connection,
4242 input: TextGenerationOperations.Request<Schema.Top>,
43 resolveAttachmentPath: ProviderHost.ProviderHostShape["resolveAttachmentPath"],
43 resolveAttachmentPath: ProviderHost.ProviderHost["Service"]["resolveAttachmentPath"],
4444) =>
4545 Effect.gen(function* () {
4646 const { client } = connection;
packages/provider-pi/src/server/adapter.test.ts+4-34
......@@ -22,7 +22,6 @@ import * as DateTime from "effect/DateTime";
2222import * as Duration from "effect/Duration";
2323import * as Effect from "effect/Effect";
2424import * as Fiber from "effect/Fiber";
25import * as FileSystem from "effect/FileSystem";
2625import * as Layer from "effect/Layer";
2726import * as PlatformError from "effect/PlatformError";
2827import * as Queue from "effect/Queue";
......@@ -31,21 +30,14 @@ import * as Sink from "effect/Sink";
3130import * as Stream from "effect/Stream";
3231import * as TestClock from "effect/testing/TestClock";
3332import { ChildProcess, ChildProcessSpawner } from "effect/process";
34import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
3533
36import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
3734import { layerTestProviderHost } from "@t3tools/provider-testing/host";
3835import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
3936import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
4037import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
4138import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
4239import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";
43import {
44 makePiAdapterV2,
45 PiAdapterV2Driver,
46 PI_PROVIDER,
47 type PiAdapterV2Options,
48} from "./adapter.ts";
40import { makePiAdapterV2, PI_PROVIDER, type PiAdapterV2Options } from "./adapter.ts";
4941import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";
5042
5143const layerTest = Layer.mergeAll(
......@@ -326,9 +318,6 @@ const makeAdapter = Effect.fnUntraced(function* (
326318 forkFake?: FakePi,
327319 continuationRequests?: PiAdapterV2Options["continuationRequests"],
328320) {
329 const idAllocator = yield* IdAllocator.IdAllocatorV2;
330 const host = yield* ProviderHost.ProviderHost;
331 const fileSystem = yield* FileSystem.FileSystem;
332321 const spawner =
333322 forkFake === undefined
334323 ? fake.spawner
......@@ -337,31 +326,12 @@ const makeAdapter = Effect.fnUntraced(function* (
337326 ? forkFake.spawner.spawn(command)
338327 : fake.spawner.spawn(command),
339328 );
340 if (continuationRequests !== undefined) {
341 return yield* PiAdapterV2Driver.create({
342 instanceId: PI_INSTANCE_ID,
343 displayName: undefined,
344 enabled: true,
345 environment: [],
346 config: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },
347 }).pipe(
348 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
349 Effect.provideService(HostProcessEnvironment, {}),
350 Effect.provideService(ProviderContinuationRequests.ProviderContinuationRequests, {
351 ...continuationRequests,
352 take: Effect.never,
353 }),
354 );
355 }
356 return makePiAdapterV2({
329 return yield* makePiAdapterV2({
357330 instanceId: PI_INSTANCE_ID,
358331 settings: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },
359332 environment: {},
360 spawner,
361 fileSystem,
362 idAllocator,
363 host,
364 });
333 ...(continuationRequests === undefined ? {} : { continuationRequests }),
334 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
365335});
366336
367337const openRuntime = Effect.fnUntraced(function* (
packages/provider-pi/src/server/adapter.ts+23-35
......@@ -228,10 +228,10 @@ export interface PiAdapterV2Options {
228228 readonly instanceId: ProviderInstanceId;
229229 readonly settings: PiSettings;
230230 readonly environment: NodeJS.ProcessEnv;
231 readonly spawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
232 readonly fileSystem: FileSystem.FileSystem;
233 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
234 readonly host: ProviderHost.ProviderHostShape;
231 /**
232 * Where to offer a wake turn for provider-initiated work. Without one, such
233 * work has no owner and the adapter stops it.
234 */
235235 readonly continuationRequests?: {
236236 readonly offer: (
237237 request: ProviderContinuationRequests.ProviderContinuationRequest,
......@@ -386,10 +386,14 @@ interface PiWake {
386386
387387// ── adapter ───────────────────────────────────────────────────
388388
389export function makePiAdapterV2(
389export const makePiAdapterV2 = Effect.fn("makePiAdapterV2")(function* (
390390 options: PiAdapterV2Options,
391): ProviderAdapter.ProviderAdapterV2Shape {
392 const { idAllocator } = options;
391) {
392 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
393 const fileSystem = yield* FileSystem.FileSystem;
394 const idAllocator = yield* IdAllocator.IdAllocatorV2;
395 const host = yield* ProviderHost.ProviderHost;
396 const { continuationRequests } = options;
393397
394398 const protocolError = (detail: string, payload?: unknown) =>
395399 new ProviderAdapter.ProviderAdapterProtocolError({
......@@ -407,11 +411,11 @@ export function makePiAdapterV2(
407411 input: ProviderAdapter.ProviderAdapterV2OpenSessionInput,
408412 ) {
409413 const scope = yield* Effect.scope;
410 const cwd = input.runtimePolicy.cwd ?? options.host.paths.cwd;
414 const cwd = input.runtimePolicy.cwd ?? host.paths.cwd;
411415 const mcpSession = McpProviderSession.readMcpProviderSession(input.threadId);
412416 const provideCacheFs = <A, E>(effect: Effect.Effect<A, E, FileSystem.FileSystem>) =>
413417 effect.pipe(
414 Effect.provideService(FileSystem.FileSystem, options.fileSystem),
418 Effect.provideService(FileSystem.FileSystem, fileSystem),
415419 Effect.mapError(
416420 (cause) =>
417421 new ProviderAdapter.ProviderAdapterOpenSessionError({
......@@ -425,7 +429,7 @@ export function makePiAdapterV2(
425429 // hook. Materialize it even when this session has no MCP credential so
426430 // Supervised never silently degrades to unrestricted tool execution.
427431 const extensionPath = yield* provideCacheFs(
428 materializePiT3McpExtension(options.host.paths.providerStatusCacheDir),
432 materializePiT3McpExtension(host.paths.providerStatusCacheDir),
429433 );
430434 const resolvedLaunchArgs = resolvePiLaunchArgs(options.settings.launchArgs);
431435 if (!resolvedLaunchArgs.ok) {
......@@ -444,7 +448,7 @@ export function makePiAdapterV2(
444448 cwd,
445449 env: launch.env,
446450 }).pipe(
447 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, options.spawner),
451 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
448452 Effect.mapError(
449453 (cause) =>
450454 new ProviderAdapter.ProviderAdapterOpenSessionError({
......@@ -1622,7 +1626,7 @@ export function makePiAdapterV2(
16221626 if (
16231627 turn === null &&
16241628 state?.providerThread.appThreadId != null &&
1625 options.continuationRequests !== undefined &&
1629 continuationRequests !== undefined &&
16261630 !closed &&
16271631 !stopRequested
16281632 ) {
......@@ -1633,7 +1637,7 @@ export function makePiAdapterV2(
16331637 return;
16341638 }
16351639 yield* updateProviderSession("running", null);
1636 yield* options.continuationRequests
1640 yield* continuationRequests
16371641 .offer({
16381642 threadId: state.providerThread.appThreadId,
16391643 providerThreadId: state.providerThread.id,
......@@ -2337,10 +2341,10 @@ export function makePiAdapterV2(
23372341 const images: Array<{ type: "image"; data: string; mimeType: string }> = [];
23382342 const extraLines: Array<string> = [];
23392343 for (const attachment of attachments) {
2340 const path = options.host.resolveAttachmentPath(attachment);
2344 const path = host.resolveAttachmentPath(attachment);
23412345 if (path === null) continue;
23422346 if (attachment.mimeType.startsWith("image/")) {
2343 const bytes = yield* options.fileSystem.readFile(path);
2347 const bytes = yield* fileSystem.readFile(path);
23442348 images.push({
23452349 type: "image",
23462350 data: Buffer.from(bytes).toString("base64"),
......@@ -3033,7 +3037,7 @@ export function makePiAdapterV2(
30333037 }
30343038 return file;
30353039 }),
3036 ).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, options.spawner));
3040 ).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
30373041 const now = yield* DateTime.now;
30383042 return yield* registerThread(
30393043 {
......@@ -3082,7 +3086,7 @@ export function makePiAdapterV2(
30823086 return runtime;
30833087 }),
30843088 });
3085}
3089});
30863090
30873091/**
30883092 * Resolve the pi session-tree entry `fork` should re-root at for a rollback.
......@@ -3210,19 +3214,11 @@ export const PiAdapterV2Driver: ProviderAdapterDriver<PiSettings, PiAdapterV2Dri
32103214 create: Effect.fn("PiAdapterV2Driver.create")(
32113215 function* (input: ProviderAdapterDriverCreateInput<PiSettings>) {
32123216 const hostEnvironment = yield* HostProcessEnvironment;
3213 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3214 const fileSystem = yield* FileSystem.FileSystem;
3215 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3216 const host = yield* ProviderHost.ProviderHost;
32173217 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
3218 return makePiAdapterV2({
3218 return yield* makePiAdapterV2({
32193219 instanceId: input.instanceId,
32203220 settings: { ...input.config, enabled: input.enabled },
32213221 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
3222 spawner,
3223 fileSystem,
3224 idAllocator,
3225 host,
32263222 continuationRequests,
32273223 });
32283224 },
......@@ -3246,19 +3242,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, PiAdapterV2Dr
32463242 ProviderAdapter.ProviderAdapterV2,
32473243 Effect.gen(function* () {
32483244 const hostEnvironment = yield* HostProcessEnvironment;
3249 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3250 const fileSystem = yield* FileSystem.FileSystem;
3251 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3252 const host = yield* ProviderHost.ProviderHost;
32533245 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
3254 return makePiAdapterV2({
3246 return yield* makePiAdapterV2({
32553247 instanceId: PI_DEFAULT_INSTANCE_ID,
32563248 settings: DEFAULT_PI_SETTINGS,
32573249 environment: hostEnvironment,
3258 spawner,
3259 fileSystem,
3260 idAllocator,
3261 host,
32623250 continuationRequests,
32633251 });
32643252 }),