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...@@ -16,7 +16,6 @@ import { HostProcessEnvironment, HostProcessPlatform } from "@t3tools/shared/hos
16import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";16import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
17import * as Clock from "effect/Clock";17import * as Clock from "effect/Clock";
18import * as Console from "effect/Console";18import * as Console from "effect/Console";
19import * as Crypto from "effect/Crypto";
20import * as Effect from "effect/Effect";19import * as Effect from "effect/Effect";
21import * as FileSystem from "effect/FileSystem";20import * as FileSystem from "effect/FileSystem";
22import * as Layer from "effect/Layer";21import * as Layer from "effect/Layer";
...@@ -25,7 +24,6 @@ import * as Schema from "effect/Schema";...@@ -25,7 +24,6 @@ import * as Schema from "effect/Schema";
25import { ChildProcessSpawner } from "effect/process";24import { ChildProcessSpawner } from "effect/process";
26import type * as EffectAcpProtocol from "effect-acp/protocol";25import type * as EffectAcpProtocol from "effect-acp/protocol";
2726
28import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
29import { layerTestProviderHost } from "@t3tools/provider-testing/host";27import { layerTestProviderHost } from "@t3tools/provider-testing/host";
30import {28import {
31 GROK_DEFAULT_INSTANCE_ID,29 GROK_DEFAULT_INSTANCE_ID,
...@@ -447,16 +445,11 @@ const recordScenario = Effect.fn("recordGrokScenario")(function* (fixtureName: s...@@ -447,16 +445,11 @@ const recordScenario = Effect.fn("recordGrokScenario")(function* (fixtureName: s
447 Effect.gen(function* () {445 Effect.gen(function* () {
448 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;446 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
449 const environment = yield* HostProcessEnvironment;447 const environment = yield* HostProcessEnvironment;
450 const adapter = makeGrokAdapterV2({448 const adapter = yield* makeGrokAdapterV2({
451 instanceId: GROK_DEFAULT_INSTANCE_ID,449 instanceId: GROK_DEFAULT_INSTANCE_ID,
452 settings,450 settings,
453 environment,451 environment,
454 hostPlatform: yield* HostProcessPlatform,452 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,
460 selfInvocation: yield* resolveSelfInvocation(),453 selfInvocation: yield* resolveSelfInvocation(),
461 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,454 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,
462 // Production's runtime factory, with the protocol logger teeing raw lines.455 // 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";...@@ -30,7 +30,6 @@ import { GrokSettings } from "@t3tools/provider-grok/settings";
30import { HostProcessIsExecutable, HostProcessPlatform } from "@t3tools/shared/hostProcess";30import { HostProcessIsExecutable, HostProcessPlatform } from "@t3tools/shared/hostProcess";
31import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";31import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
32import * as DateTime from "effect/DateTime";32import * as DateTime from "effect/DateTime";
33import * as Crypto from "effect/Crypto";
34import * as Deferred from "effect/Deferred";33import * as Deferred from "effect/Deferred";
35import type * as Duration from "effect/Duration";34import type * as Duration from "effect/Duration";
36import * as Cause from "effect/Cause";35import * as Cause from "effect/Cause";
...@@ -54,7 +53,6 @@ import * as EffectAcpErrors from "effect-acp/errors";...@@ -54,7 +53,6 @@ import * as EffectAcpErrors from "effect-acp/errors";
54import type * as EffectAcpProtocol from "effect-acp/protocol";53import type * as EffectAcpProtocol from "effect-acp/protocol";
55import type * as EffectAcpSchema from "effect-acp/compat";54import type * as EffectAcpSchema from "effect-acp/compat";
5655
57import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
58import { layerTestProviderHost } from "@t3tools/provider-testing/host";56import { layerTestProviderHost } from "@t3tools/provider-testing/host";
59import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";57import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
60import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";58import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
...@@ -610,12 +608,8 @@ describe("AcpAdapterV2", () => {...@@ -610,12 +608,8 @@ describe("AcpAdapterV2", () => {
610 const path = yield* Path.Path;608 const path = yield* Path.Path;
611 const instanceId = ProviderInstanceId.make(`vibe-retry-${outcome}`);609 const instanceId = ProviderInstanceId.make(`vibe-retry-${outcome}`);
612 const threadId = ThreadId.make(`thread-vibe-retry-${outcome}`);610 const threadId = ThreadId.make(`thread-vibe-retry-${outcome}`);
613 const adapter = makeAcpAdapterV2({611 const adapter = yield* makeAcpAdapterV2({
614 crypto: yield* Crypto.Crypto,
615 instanceId,612 instanceId,
616 fileSystem: yield* FileSystem.FileSystem,
617 idAllocator: yield* IdAllocator.IdAllocatorV2,
618 host: yield* ProviderHost.ProviderHost,
619 selfInvocation: yield* resolveSelfInvocation(),613 selfInvocation: yield* resolveSelfInvocation(),
620 flavor: {614 flavor: {
621 driver: ProviderDriverKind.make("acpRegistry"),615 driver: ProviderDriverKind.make("acpRegistry"),
...@@ -709,10 +703,7 @@ describe("AcpAdapterV2", () => {...@@ -709,10 +703,7 @@ describe("AcpAdapterV2", () => {
709 it.effect("starts the MCP bridge directly from the self-contained runtime", () =>703 it.effect("starts the MCP bridge directly from the self-contained runtime", () =>
710 Effect.gen(function* () {704 Effect.gen(function* () {
711 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;705 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
712 const fileSystem = yield* FileSystem.FileSystem;
713 const idAllocator = yield* IdAllocator.IdAllocatorV2;
714 const path = yield* Path.Path;706 const path = yield* Path.Path;
715 const host = yield* ProviderHost.ProviderHost;
716 const selfInvocation = yield* resolveSelfInvocation().pipe(707 const selfInvocation = yield* resolveSelfInvocation().pipe(
717 Effect.provideService(HostProcessIsExecutable, true),708 Effect.provideService(HostProcessIsExecutable, true),
718 );709 );
...@@ -739,8 +730,7 @@ describe("AcpAdapterV2", () => {...@@ -739,8 +730,7 @@ describe("AcpAdapterV2", () => {
739730
740 let runtimeInput: AcpAdapterV2RuntimeInput | undefined;731 let runtimeInput: AcpAdapterV2RuntimeInput | undefined;
741 const makeRuntime = makeMockRuntime({ childProcessSpawner, mockAgentPath });732 const makeRuntime = makeMockRuntime({ childProcessSpawner, mockAgentPath });
742 const adapter = makeAcpAdapterV2({733 const adapter = yield* makeAcpAdapterV2({
743 crypto: yield* Crypto.Crypto,
744 instanceId,734 instanceId,
745 flavor: {735 flavor: {
746 driver: ACP_TEST_DRIVER,736 driver: ACP_TEST_DRIVER,
...@@ -750,9 +740,6 @@ describe("AcpAdapterV2", () => {...@@ -750,9 +740,6 @@ describe("AcpAdapterV2", () => {
750 runtimeInput = input;740 runtimeInput = input;
751 }).pipe(Effect.andThen(makeRuntime(input))),741 }).pipe(Effect.andThen(makeRuntime(input))),
752 },742 },
753 fileSystem,
754 idAllocator,
755 host,
756 selfInvocation,743 selfInvocation,
757 });744 });
758 const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({745 const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({
...@@ -782,10 +769,7 @@ describe("AcpAdapterV2", () => {...@@ -782,10 +769,7 @@ describe("AcpAdapterV2", () => {
782 it.live("refreshes ACP prompt instructions when the interaction mode changes", () =>769 it.live("refreshes ACP prompt instructions when the interaction mode changes", () =>
783 Effect.gen(function* () {770 Effect.gen(function* () {
784 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;771 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
785 const fileSystem = yield* FileSystem.FileSystem;
786 const idAllocator = yield* IdAllocator.IdAllocatorV2;
787 const path = yield* Path.Path;772 const path = yield* Path.Path;
788 const host = yield* ProviderHost.ProviderHost;
789 const selfInvocation = yield* resolveSelfInvocation();773 const selfInvocation = yield* resolveSelfInvocation();
790 const mockAgentPath = yield* path.fromFileUrl(774 const mockAgentPath = yield* path.fromFileUrl(
791 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),775 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -805,17 +789,13 @@ describe("AcpAdapterV2", () => {...@@ -805,17 +789,13 @@ describe("AcpAdapterV2", () => {
805 yield* Effect.addFinalizer(() =>789 yield* Effect.addFinalizer(() =>
806 Effect.sync(() => McpProviderSession.clearMcpProviderSession(threadId)),790 Effect.sync(() => McpProviderSession.clearMcpProviderSession(threadId)),
807 );791 );
808 const adapter = makeAcpAdapterV2({792 const adapter = yield* makeAcpAdapterV2({
809 crypto: yield* Crypto.Crypto,
810 instanceId,793 instanceId,
811 flavor: {794 flavor: {
812 driver: ACP_TEST_DRIVER,795 driver: ACP_TEST_DRIVER,
813 capabilities: AcpProviderCapabilitiesV2,796 capabilities: AcpProviderCapabilitiesV2,
814 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),797 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
815 },798 },
816 fileSystem,
817 idAllocator,
818 host,
819 selfInvocation,799 selfInvocation,
820 });800 });
821 const policy = (interactionMode: "default" | "plan") =>801 const policy = (interactionMode: "default" | "plan") =>
...@@ -909,10 +889,7 @@ describe("AcpAdapterV2", () => {...@@ -909,10 +889,7 @@ describe("AcpAdapterV2", () => {
909 it.effect("starts a new replay message after ACP v2 plan boundaries", () =>889 it.effect("starts a new replay message after ACP v2 plan boundaries", () =>
910 Effect.gen(function* () {890 Effect.gen(function* () {
911 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;891 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
912 const fileSystem = yield* FileSystem.FileSystem;
913 const idAllocator = yield* IdAllocator.IdAllocatorV2;
914 const path = yield* Path.Path;892 const path = yield* Path.Path;
915 const host = yield* ProviderHost.ProviderHost;
916 const selfInvocation = yield* resolveSelfInvocation();893 const selfInvocation = yield* resolveSelfInvocation();
917 const mockAgentPath = yield* path.fromFileUrl(894 const mockAgentPath = yield* path.fromFileUrl(
918 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),895 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -920,8 +897,7 @@ describe("AcpAdapterV2", () => {...@@ -920,8 +897,7 @@ describe("AcpAdapterV2", () => {
920 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];897 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
921 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;898 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
922 const instanceId = ProviderInstanceId.make("acp-test-v2-plan-replay-boundary");899 const instanceId = ProviderInstanceId.make("acp-test-v2-plan-replay-boundary");
923 const adapter = makeAcpAdapterV2({900 const adapter = yield* makeAcpAdapterV2({
924 crypto: yield* Crypto.Crypto,
925 instanceId,901 instanceId,
926 flavor: {902 flavor: {
927 driver: ACP_TEST_DRIVER,903 driver: ACP_TEST_DRIVER,
...@@ -938,9 +914,6 @@ describe("AcpAdapterV2", () => {...@@ -938,9 +914,6 @@ describe("AcpAdapterV2", () => {
938 }),914 }),
939 }),915 }),
940 },916 },
941 fileSystem,
942 idAllocator,
943 host,
944 selfInvocation,917 selfInvocation,
945 });918 });
946 const threadId = ThreadId.make("thread-acp-v2-plan-replay-boundary");919 const threadId = ThreadId.make("thread-acp-v2-plan-replay-boundary");
...@@ -1043,12 +1016,8 @@ describe("AcpAdapterV2", () => {...@@ -1043,12 +1016,8 @@ describe("AcpAdapterV2", () => {
1043 ];1016 ];
1044 };1017 };
1045 const instanceId = ProviderInstanceId.make("devin-streamed-write");1018 const instanceId = ProviderInstanceId.make("devin-streamed-write");
1046 const adapter = makeAcpAdapterV2({1019 const adapter = yield* makeAcpAdapterV2({
1047 instanceId,1020 instanceId,
1048 crypto: yield* Crypto.Crypto,
1049 fileSystem: yield* FileSystem.FileSystem,
1050 idAllocator: yield* IdAllocator.IdAllocatorV2,
1051 host: yield* ProviderHost.ProviderHost,
1052 selfInvocation: yield* resolveSelfInvocation(),1021 selfInvocation: yield* resolveSelfInvocation(),
1053 flavor: {1022 flavor: {
1054 driver: ACP_TEST_DRIVER,1023 driver: ACP_TEST_DRIVER,
...@@ -1178,7 +1147,6 @@ describe("AcpAdapterV2", () => {...@@ -1178,7 +1147,6 @@ describe("AcpAdapterV2", () => {
1178 it.effect("keeps Devin parent paragraphs intact while projecting native child work", () =>1147 it.effect("keeps Devin parent paragraphs intact while projecting native child work", () =>
1179 Effect.gen(function* () {1148 Effect.gen(function* () {
1180 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1149 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1181 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1182 const path = yield* Path.Path;1150 const path = yield* Path.Path;
1183 const mockAgentPath = yield* path.fromFileUrl(1151 const mockAgentPath = yield* path.fromFileUrl(
1184 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1152 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -1187,14 +1155,10 @@ describe("AcpAdapterV2", () => {...@@ -1187,14 +1155,10 @@ describe("AcpAdapterV2", () => {
1187 let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;1155 let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
1188 let createTerminal: Parameters<Runtime["handleCreateTerminal"]>[0] | undefined;1156 let createTerminal: Parameters<Runtime["handleCreateTerminal"]>[0] | undefined;
1189 const instanceId = ProviderInstanceId.make("devin-replay");1157 const instanceId = ProviderInstanceId.make("devin-replay");
1190 const adapter = makeAcpAdapterV2({1158 const adapter = yield* makeAcpAdapterV2({
1191 instanceId,1159 instanceId,
1192 // Production Devin runs commands through client terminals.1160 // Production Devin runs commands through client terminals.
1193 clientTerminals: { childProcessSpawner, shellCommands: true },1161 clientTerminals: { childProcessSpawner, shellCommands: true },
1194 crypto: yield* Crypto.Crypto,
1195 fileSystem: yield* FileSystem.FileSystem,
1196 idAllocator,
1197 host: yield* ProviderHost.ProviderHost,
1198 selfInvocation: yield* resolveSelfInvocation(),1162 selfInvocation: yield* resolveSelfInvocation(),
1199 flavor: {1163 flavor: {
1200 driver: ACP_TEST_DRIVER,1164 driver: ACP_TEST_DRIVER,
...@@ -1511,10 +1475,7 @@ describe("AcpAdapterV2", () => {...@@ -1511,10 +1475,7 @@ describe("AcpAdapterV2", () => {
1511 it.effect("projects ACP v2 fidelity updates into first-class orchestration items", () =>1475 it.effect("projects ACP v2 fidelity updates into first-class orchestration items", () =>
1512 Effect.gen(function* () {1476 Effect.gen(function* () {
1513 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1477 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1514 const fileSystem = yield* FileSystem.FileSystem;
1515 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1516 const path = yield* Path.Path;1478 const path = yield* Path.Path;
1517 const host = yield* ProviderHost.ProviderHost;
1518 const selfInvocation = yield* resolveSelfInvocation();1479 const selfInvocation = yield* resolveSelfInvocation();
1519 const mockAgentPath = yield* path.fromFileUrl(1480 const mockAgentPath = yield* path.fromFileUrl(
1520 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1481 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -1522,8 +1483,7 @@ describe("AcpAdapterV2", () => {...@@ -1522,8 +1483,7 @@ describe("AcpAdapterV2", () => {
1522 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];1483 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
1523 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;1484 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
1524 const instanceId = ProviderInstanceId.make("acp-test-v2-fidelity");1485 const instanceId = ProviderInstanceId.make("acp-test-v2-fidelity");
1525 const adapter = makeAcpAdapterV2({1486 const adapter = yield* makeAcpAdapterV2({
1526 crypto: yield* Crypto.Crypto,
1527 instanceId,1487 instanceId,
1528 flavor: {1488 flavor: {
1529 driver: ACP_TEST_DRIVER,1489 driver: ACP_TEST_DRIVER,
...@@ -1541,9 +1501,6 @@ describe("AcpAdapterV2", () => {...@@ -1541,9 +1501,6 @@ describe("AcpAdapterV2", () => {
1541 }),1501 }),
1542 }),1502 }),
1543 },1503 },
1544 fileSystem,
1545 idAllocator,
1546 host,
1547 selfInvocation,1504 selfInvocation,
1548 });1505 });
1549 const threadId = ThreadId.make("thread-acp-v2-fidelity");1506 const threadId = ThreadId.make("thread-acp-v2-fidelity");
...@@ -1705,18 +1662,15 @@ describe("AcpAdapterV2", () => {...@@ -1705,18 +1662,15 @@ describe("AcpAdapterV2", () => {
1705 () =>1662 () =>
1706 Effect.gen(function* () {1663 Effect.gen(function* () {
1707 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1664 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1708 const fileSystem = yield* FileSystem.FileSystem;
1709 const idAllocator = yield* IdAllocator.IdAllocatorV2;1665 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1710 const path = yield* Path.Path;1666 const path = yield* Path.Path;
1711 const host = yield* ProviderHost.ProviderHost;
1712 const selfInvocation = yield* resolveSelfInvocation();1667 const selfInvocation = yield* resolveSelfInvocation();
1713 const mockAgentPath = yield* path.fromFileUrl(1668 const mockAgentPath = yield* path.fromFileUrl(
1714 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1669 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1715 );1670 );
1716 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();1671 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
1717 const instanceId = ProviderInstanceId.make("acp-test-eager-resume");1672 const instanceId = ProviderInstanceId.make("acp-test-eager-resume");
1718 const adapter = makeAcpAdapterV2({1673 const adapter = yield* makeAcpAdapterV2({
1719 crypto: yield* Crypto.Crypto,
1720 instanceId,1674 instanceId,
1721 flavor: {1675 flavor: {
1722 driver: ACP_TEST_DRIVER,1676 driver: ACP_TEST_DRIVER,
...@@ -1727,9 +1681,6 @@ describe("AcpAdapterV2", () => {...@@ -1727,9 +1681,6 @@ describe("AcpAdapterV2", () => {
1727 protocolEvents,1681 protocolEvents,
1728 }),1682 }),
1729 },1683 },
1730 fileSystem,
1731 idAllocator,
1732 host,
1733 selfInvocation,1684 selfInvocation,
1734 });1685 });
1735 const threadId = ThreadId.make("thread-acp-eager-resume");1686 const threadId = ThreadId.make("thread-acp-eager-resume");
...@@ -1790,18 +1741,15 @@ describe("AcpAdapterV2", () => {...@@ -1790,18 +1741,15 @@ describe("AcpAdapterV2", () => {
1790 it.live("preserves new-session fallback when an eager ACP session load is stale", () =>1741 it.live("preserves new-session fallback when an eager ACP session load is stale", () =>
1791 Effect.gen(function* () {1742 Effect.gen(function* () {
1792 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1743 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1793 const fileSystem = yield* FileSystem.FileSystem;
1794 const idAllocator = yield* IdAllocator.IdAllocatorV2;1744 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1795 const path = yield* Path.Path;1745 const path = yield* Path.Path;
1796 const host = yield* ProviderHost.ProviderHost;
1797 const selfInvocation = yield* resolveSelfInvocation();1746 const selfInvocation = yield* resolveSelfInvocation();
1798 const mockAgentPath = yield* path.fromFileUrl(1747 const mockAgentPath = yield* path.fromFileUrl(
1799 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1748 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1800 );1749 );
1801 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();1750 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
1802 const instanceId = ProviderInstanceId.make("acp-test-stale-eager-resume");1751 const instanceId = ProviderInstanceId.make("acp-test-stale-eager-resume");
1803 const adapter = makeAcpAdapterV2({1752 const adapter = yield* makeAcpAdapterV2({
1804 crypto: yield* Crypto.Crypto,
1805 instanceId,1753 instanceId,
1806 flavor: {1754 flavor: {
1807 driver: ACP_TEST_DRIVER,1755 driver: ACP_TEST_DRIVER,
...@@ -1814,9 +1762,6 @@ describe("AcpAdapterV2", () => {...@@ -1814,9 +1762,6 @@ describe("AcpAdapterV2", () => {
1814 runtimeOrdinal === 1 ? { T3_ACP_FAIL_LOAD_SESSION: "1" } : {},1762 runtimeOrdinal === 1 ? { T3_ACP_FAIL_LOAD_SESSION: "1" } : {},
1815 }),1763 }),
1816 },1764 },
1817 fileSystem,
1818 idAllocator,
1819 host,
1820 selfInvocation,1765 selfInvocation,
1821 });1766 });
1822 const threadId = ThreadId.make("thread-acp-stale-eager-resume");1767 const threadId = ThreadId.make("thread-acp-stale-eager-resume");
...@@ -1936,10 +1881,7 @@ describe("AcpAdapterV2", () => {...@@ -1936,10 +1881,7 @@ describe("AcpAdapterV2", () => {
1936 it.live("replaces an unexpectedly terminated ACP runtime before the next turn", () =>1881 it.live("replaces an unexpectedly terminated ACP runtime before the next turn", () =>
1937 Effect.gen(function* () {1882 Effect.gen(function* () {
1938 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1883 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1939 const fileSystem = yield* FileSystem.FileSystem;
1940 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1941 const path = yield* Path.Path;1884 const path = yield* Path.Path;
1942 const host = yield* ProviderHost.ProviderHost;
1943 const selfInvocation = yield* resolveSelfInvocation();1885 const selfInvocation = yield* resolveSelfInvocation();
1944 const mockAgentPath = yield* path.fromFileUrl(1886 const mockAgentPath = yield* path.fromFileUrl(
1945 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1887 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -1955,8 +1897,7 @@ describe("AcpAdapterV2", () => {...@@ -1955,8 +1897,7 @@ describe("AcpAdapterV2", () => {
1955 },1897 },
1956 });1898 });
1957 const instanceId = ProviderInstanceId.make("acp-test-unexpected-termination");1899 const instanceId = ProviderInstanceId.make("acp-test-unexpected-termination");
1958 const adapter = makeAcpAdapterV2({1900 const adapter = yield* makeAcpAdapterV2({
1959 crypto: yield* Crypto.Crypto,
1960 instanceId,1901 instanceId,
1961 flavor: {1902 flavor: {
1962 driver: ACP_TEST_DRIVER,1903 driver: ACP_TEST_DRIVER,
...@@ -1966,9 +1907,6 @@ describe("AcpAdapterV2", () => {...@@ -1966,9 +1907,6 @@ describe("AcpAdapterV2", () => {
1966 runtimeInputs.push(runtimeInput);1907 runtimeInputs.push(runtimeInput);
1967 }).pipe(Effect.andThen(baseMakeRuntime(runtimeInput))),1908 }).pipe(Effect.andThen(baseMakeRuntime(runtimeInput))),
1968 },1909 },
1969 fileSystem,
1970 idAllocator,
1971 host,
1972 selfInvocation,1910 selfInvocation,
1973 });1911 });
1974 const threadId = ThreadId.make("thread-acp-unexpected-termination");1912 const threadId = ThreadId.make("thread-acp-unexpected-termination");
...@@ -2020,9 +1958,7 @@ describe("AcpAdapterV2", () => {...@@ -2020,9 +1958,7 @@ describe("AcpAdapterV2", () => {
2020 if ((yield* HostProcessPlatform) !== "linux") return;1958 if ((yield* HostProcessPlatform) !== "linux") return;
2021 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;1959 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2022 const fileSystem = yield* FileSystem.FileSystem;1960 const fileSystem = yield* FileSystem.FileSystem;
2023 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2024 const path = yield* Path.Path;1961 const path = yield* Path.Path;
2025 const host = yield* ProviderHost.ProviderHost;
2026 const selfInvocation = yield* resolveSelfInvocation();1962 const selfInvocation = yield* resolveSelfInvocation();
2027 const mockAgentPath = yield* path.fromFileUrl(1963 const mockAgentPath = yield* path.fromFileUrl(
2028 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),1964 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2034,8 +1970,7 @@ describe("AcpAdapterV2", () => {...@@ -2034,8 +1970,7 @@ describe("AcpAdapterV2", () => {
2034 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),1970 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),
2035 );1971 );
2036 const instanceId = ProviderInstanceId.make("acp-test-provider-exit");1972 const instanceId = ProviderInstanceId.make("acp-test-provider-exit");
2037 const adapter = makeAcpAdapterV2({1973 const adapter = yield* makeAcpAdapterV2({
2038 crypto: yield* Crypto.Crypto,
2039 instanceId,1974 instanceId,
2040 flavor: {1975 flavor: {
2041 driver: ACP_TEST_DRIVER,1976 driver: ACP_TEST_DRIVER,
...@@ -2055,9 +1990,6 @@ describe("AcpAdapterV2", () => {...@@ -2055,9 +1990,6 @@ describe("AcpAdapterV2", () => {
2055 },1990 },
2056 }),1991 }),
2057 },1992 },
2058 fileSystem,
2059 idAllocator,
2060 host,
2061 selfInvocation,1993 selfInvocation,
2062 });1994 });
2063 const threadId = ThreadId.make("thread-acp-provider-exit-running-command");1995 const threadId = ThreadId.make("thread-acp-provider-exit-running-command");
...@@ -2104,10 +2036,7 @@ describe("AcpAdapterV2", () => {...@@ -2104,10 +2036,7 @@ describe("AcpAdapterV2", () => {
2104 Effect.gen(function* () {2036 Effect.gen(function* () {
2105 if ((yield* HostProcessPlatform) !== "linux") return;2037 if ((yield* HostProcessPlatform) !== "linux") return;
2106 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2038 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2107 const fileSystem = yield* FileSystem.FileSystem;
2108 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2109 const path = yield* Path.Path;2039 const path = yield* Path.Path;
2110 const host = yield* ProviderHost.ProviderHost;
2111 const selfInvocation = yield* resolveSelfInvocation();2040 const selfInvocation = yield* resolveSelfInvocation();
2112 const mockAgentPath = yield* path.fromFileUrl(2041 const mockAgentPath = yield* path.fromFileUrl(
2113 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2042 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2116,8 +2045,7 @@ describe("AcpAdapterV2", () => {...@@ -2116,8 +2045,7 @@ describe("AcpAdapterV2", () => {
2116 | AcpSessionRuntime.AcpSessionRuntime["Service"]["processContainment"]2045 | AcpSessionRuntime.AcpSessionRuntime["Service"]["processContainment"]
2117 | undefined;2046 | undefined;
2118 const instanceId = ProviderInstanceId.make("acp-test-cgroup-unavailable");2047 const instanceId = ProviderInstanceId.make("acp-test-cgroup-unavailable");
2119 const adapter = makeAcpAdapterV2({2048 const adapter = yield* makeAcpAdapterV2({
2120 crypto: yield* Crypto.Crypto,
2121 instanceId,2049 instanceId,
2122 flavor: {2050 flavor: {
2123 driver: ACP_TEST_DRIVER,2051 driver: ACP_TEST_DRIVER,
...@@ -2134,9 +2062,6 @@ describe("AcpAdapterV2", () => {...@@ -2134,9 +2062,6 @@ describe("AcpAdapterV2", () => {
2134 },2062 },
2135 }),2063 }),
2136 },2064 },
2137 fileSystem,
2138 idAllocator,
2139 host,
2140 selfInvocation,2065 selfInvocation,
2141 });2066 });
2142 const threadId = ThreadId.make("thread-acp-cgroup-unavailable");2067 const threadId = ThreadId.make("thread-acp-cgroup-unavailable");
...@@ -2160,10 +2085,7 @@ describe("AcpAdapterV2", () => {...@@ -2160,10 +2085,7 @@ describe("AcpAdapterV2", () => {
2160 it.live("cleans a cgroup lease when the pre-exec join wrapper fails", () =>2085 it.live("cleans a cgroup lease when the pre-exec join wrapper fails", () =>
2161 Effect.gen(function* () {2086 Effect.gen(function* () {
2162 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2087 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2163 const fileSystem = yield* FileSystem.FileSystem;
2164 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2165 const path = yield* Path.Path;2088 const path = yield* Path.Path;
2166 const host = yield* ProviderHost.ProviderHost;
2167 const selfInvocation = yield* resolveSelfInvocation();2089 const selfInvocation = yield* resolveSelfInvocation();
2168 const mockAgentPath = yield* path.fromFileUrl(2090 const mockAgentPath = yield* path.fromFileUrl(
2169 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2091 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2192,8 +2114,7 @@ describe("AcpAdapterV2", () => {...@@ -2192,8 +2114,7 @@ describe("AcpAdapterV2", () => {
2192 },2114 },
2193 };2115 };
2194 const instanceId = ProviderInstanceId.make("acp-test-cgroup-join-failure");2116 const instanceId = ProviderInstanceId.make("acp-test-cgroup-join-failure");
2195 const adapter = makeAcpAdapterV2({2117 const adapter = yield* makeAcpAdapterV2({
2196 crypto: yield* Crypto.Crypto,
2197 instanceId,2118 instanceId,
2198 flavor: {2119 flavor: {
2199 driver: ACP_TEST_DRIVER,2120 driver: ACP_TEST_DRIVER,
...@@ -2206,9 +2127,6 @@ describe("AcpAdapterV2", () => {...@@ -2206,9 +2127,6 @@ describe("AcpAdapterV2", () => {
2206 ownDetachedProcessGroup: true,2127 ownDetachedProcessGroup: true,
2207 }),2128 }),
2208 },2129 },
2209 fileSystem,
2210 idAllocator,
2211 host,
2212 selfInvocation,2130 selfInvocation,
2213 });2131 });
2214 const threadId = ThreadId.make("thread-acp-cgroup-join-failure");2132 const threadId = ThreadId.make("thread-acp-cgroup-join-failure");
...@@ -2238,10 +2156,7 @@ describe("AcpAdapterV2", () => {...@@ -2238,10 +2156,7 @@ describe("AcpAdapterV2", () => {
2238 it.effect("negotiates and executes optional native session forks through the ACP runtime", () =>2156 it.effect("negotiates and executes optional native session forks through the ACP runtime", () =>
2239 Effect.gen(function* () {2157 Effect.gen(function* () {
2240 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2158 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2241 const fileSystem = yield* FileSystem.FileSystem;
2242 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2243 const path = yield* Path.Path;2159 const path = yield* Path.Path;
2244 const host = yield* ProviderHost.ProviderHost;
2245 const selfInvocation = yield* resolveSelfInvocation();2160 const selfInvocation = yield* resolveSelfInvocation();
2246 const mockAgentPath = yield* path.fromFileUrl(2161 const mockAgentPath = yield* path.fromFileUrl(
2247 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2162 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2275,17 +2190,13 @@ describe("AcpAdapterV2", () => {...@@ -2275,17 +2190,13 @@ describe("AcpAdapterV2", () => {
2275 });2190 });
22762191
2277 const instanceId = ProviderInstanceId.make("acp-test");2192 const instanceId = ProviderInstanceId.make("acp-test");
2278 const adapter = makeAcpAdapterV2({2193 const adapter = yield* makeAcpAdapterV2({
2279 crypto: yield* Crypto.Crypto,
2280 instanceId,2194 instanceId,
2281 flavor: {2195 flavor: {
2282 driver: ACP_TEST_DRIVER,2196 driver: ACP_TEST_DRIVER,
2283 capabilities: AcpProviderCapabilitiesV2,2197 capabilities: AcpProviderCapabilitiesV2,
2284 makeRuntime,2198 makeRuntime,
2285 },2199 },
2286 fileSystem,
2287 idAllocator,
2288 host,
2289 selfInvocation,2200 selfInvocation,
2290 clientTerminals: { childProcessSpawner },2201 clientTerminals: { childProcessSpawner },
2291 });2202 });
...@@ -2451,9 +2362,7 @@ describe("AcpAdapterV2", () => {...@@ -2451,9 +2362,7 @@ describe("AcpAdapterV2", () => {
2451 Effect.gen(function* () {2362 Effect.gen(function* () {
2452 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2363 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2453 const fileSystem = yield* FileSystem.FileSystem;2364 const fileSystem = yield* FileSystem.FileSystem;
2454 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2455 const path = yield* Path.Path;2365 const path = yield* Path.Path;
2456 const host = yield* ProviderHost.ProviderHost;
2457 const selfInvocation = yield* resolveSelfInvocation();2366 const selfInvocation = yield* resolveSelfInvocation();
2458 const mockAgentPath = yield* path.fromFileUrl(2367 const mockAgentPath = yield* path.fromFileUrl(
2459 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2368 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2465,8 +2374,7 @@ describe("AcpAdapterV2", () => {...@@ -2465,8 +2374,7 @@ describe("AcpAdapterV2", () => {
2465 const probeLogPath = path.join(workspace, "fs-probe.jsonl");2374 const probeLogPath = path.join(workspace, "fs-probe.jsonl");
2466 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();2375 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
2467 const instanceId = ProviderInstanceId.make("acp-test-no-client-fs");2376 const instanceId = ProviderInstanceId.make("acp-test-no-client-fs");
2468 const adapter = makeAcpAdapterV2({2377 const adapter = yield* makeAcpAdapterV2({
2469 crypto: yield* Crypto.Crypto,
2470 instanceId,2378 instanceId,
2471 flavor: {2379 flavor: {
2472 driver: ACP_TEST_DRIVER,2380 driver: ACP_TEST_DRIVER,
...@@ -2481,9 +2389,6 @@ describe("AcpAdapterV2", () => {...@@ -2481,9 +2389,6 @@ describe("AcpAdapterV2", () => {
2481 },2389 },
2482 }),2390 }),
2483 },2391 },
2484 fileSystem,
2485 idAllocator,
2486 host,
2487 selfInvocation,2392 selfInvocation,
2488 });2393 });
2489 const threadId = ThreadId.make("thread-acp-no-client-fs");2394 const threadId = ThreadId.make("thread-acp-no-client-fs");
...@@ -2547,10 +2452,7 @@ describe("AcpAdapterV2", () => {...@@ -2547,10 +2452,7 @@ describe("AcpAdapterV2", () => {
2547 it.effect("does not turn an unknown permission approval into an execute grant", () =>2452 it.effect("does not turn an unknown permission approval into an execute grant", () =>
2548 Effect.gen(function* () {2453 Effect.gen(function* () {
2549 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2454 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2550 const fileSystem = yield* FileSystem.FileSystem;
2551 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2552 const path = yield* Path.Path;2455 const path = yield* Path.Path;
2553 const host = yield* ProviderHost.ProviderHost;
2554 const selfInvocation = yield* resolveSelfInvocation();2456 const selfInvocation = yield* resolveSelfInvocation();
2555 const mockAgentPath = yield* path.fromFileUrl(2457 const mockAgentPath = yield* path.fromFileUrl(
2556 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2458 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2576,8 +2478,7 @@ describe("AcpAdapterV2", () => {...@@ -2576,8 +2478,7 @@ describe("AcpAdapterV2", () => {
2576 }),2478 }),
2577 });2479 });
2578 const instanceId = ProviderInstanceId.make("acp-test-unknown-permission-grant");2480 const instanceId = ProviderInstanceId.make("acp-test-unknown-permission-grant");
2579 const adapter = makeAcpAdapterV2({2481 const adapter = yield* makeAcpAdapterV2({
2580 crypto: yield* Crypto.Crypto,
2581 instanceId,2482 instanceId,
2582 flavor: {2483 flavor: {
2583 driver: ACP_TEST_DRIVER,2484 driver: ACP_TEST_DRIVER,
...@@ -2588,9 +2489,6 @@ describe("AcpAdapterV2", () => {...@@ -2588,9 +2489,6 @@ describe("AcpAdapterV2", () => {
2588 runtimeInput = input;2489 runtimeInput = input;
2589 }).pipe(Effect.andThen(makeRuntime(input))),2490 }).pipe(Effect.andThen(makeRuntime(input))),
2590 },2491 },
2591 fileSystem,
2592 idAllocator,
2593 host,
2594 selfInvocation,2492 selfInvocation,
2595 clientTerminals: { childProcessSpawner },2493 clientTerminals: { childProcessSpawner },
2596 });2494 });
...@@ -2684,26 +2582,19 @@ describe("AcpAdapterV2", () => {...@@ -2684,26 +2582,19 @@ describe("AcpAdapterV2", () => {
2684 it.effect("fails missing native ACP session ids through the typed start-turn error channel", () =>2582 it.effect("fails missing native ACP session ids through the typed start-turn error channel", () =>
2685 Effect.gen(function* () {2583 Effect.gen(function* () {
2686 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2584 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2687 const fileSystem = yield* FileSystem.FileSystem;
2688 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2689 const path = yield* Path.Path;2585 const path = yield* Path.Path;
2690 const host = yield* ProviderHost.ProviderHost;
2691 const selfInvocation = yield* resolveSelfInvocation();2586 const selfInvocation = yield* resolveSelfInvocation();
2692 const mockAgentPath = yield* path.fromFileUrl(2587 const mockAgentPath = yield* path.fromFileUrl(
2693 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2588 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2694 );2589 );
2695 const instanceId = ProviderInstanceId.make("acp-test-missing-native-thread");2590 const instanceId = ProviderInstanceId.make("acp-test-missing-native-thread");
2696 const adapter = makeAcpAdapterV2({2591 const adapter = yield* makeAcpAdapterV2({
2697 crypto: yield* Crypto.Crypto,
2698 instanceId,2592 instanceId,
2699 flavor: {2593 flavor: {
2700 driver: ACP_TEST_DRIVER,2594 driver: ACP_TEST_DRIVER,
2701 capabilities: AcpProviderCapabilitiesV2,2595 capabilities: AcpProviderCapabilitiesV2,
2702 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),2596 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),
2703 },2597 },
2704 fileSystem,
2705 idAllocator,
2706 host,
2707 selfInvocation,2598 selfInvocation,
2708 });2599 });
2709 const threadId = ThreadId.make("thread-acp-missing-native-thread");2600 const threadId = ThreadId.make("thread-acp-missing-native-thread");
...@@ -2746,10 +2637,8 @@ describe("AcpAdapterV2", () => {...@@ -2746,10 +2637,8 @@ describe("AcpAdapterV2", () => {
2746 it.effect("replaces the ACP session and clears conversation state on rollback", () =>2637 it.effect("replaces the ACP session and clears conversation state on rollback", () =>
2747 Effect.gen(function* () {2638 Effect.gen(function* () {
2748 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2639 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2749 const fileSystem = yield* FileSystem.FileSystem;
2750 const idAllocator = yield* IdAllocator.IdAllocatorV2;2640 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2751 const path = yield* Path.Path;2641 const path = yield* Path.Path;
2752 const host = yield* ProviderHost.ProviderHost;
2753 const selfInvocation = yield* resolveSelfInvocation();2642 const selfInvocation = yield* resolveSelfInvocation();
2754 const mockAgentPath = yield* path.fromFileUrl(2643 const mockAgentPath = yield* path.fromFileUrl(
2755 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2644 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2774,8 +2663,7 @@ describe("AcpAdapterV2", () => {...@@ -2774,8 +2663,7 @@ describe("AcpAdapterV2", () => {
2774 mockAgentPath,2663 mockAgentPath,
2775 environment: { T3_ACP_PROMPT_DELAY_MS: "100" },2664 environment: { T3_ACP_PROMPT_DELAY_MS: "100" },
2776 });2665 });
2777 const adapter = makeAcpAdapterV2({2666 const adapter = yield* makeAcpAdapterV2({
2778 crypto: yield* Crypto.Crypto,
2779 instanceId,2667 instanceId,
2780 flavor: {2668 flavor: {
2781 driver: ACP_TEST_DRIVER,2669 driver: ACP_TEST_DRIVER,
...@@ -2785,9 +2673,6 @@ describe("AcpAdapterV2", () => {...@@ -2785,9 +2673,6 @@ describe("AcpAdapterV2", () => {
2785 Effect.andThen(makeRuntime(runtimeInput)),2673 Effect.andThen(makeRuntime(runtimeInput)),
2786 ),2674 ),
2787 },2675 },
2788 fileSystem,
2789 idAllocator,
2790 host,
2791 selfInvocation,2676 selfInvocation,
2792 });2677 });
2793 const threadId = ThreadId.make("thread-acp-rollback-session");2678 const threadId = ThreadId.make("thread-acp-rollback-session");
...@@ -2913,10 +2798,7 @@ describe("AcpAdapterV2", () => {...@@ -2913,10 +2798,7 @@ describe("AcpAdapterV2", () => {
2913 it.effect("quarantines callbacks from a failed rollback replacement before retrying", () =>2798 it.effect("quarantines callbacks from a failed rollback replacement before retrying", () =>
2914 Effect.gen(function* () {2799 Effect.gen(function* () {
2915 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2800 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2916 const fileSystem = yield* FileSystem.FileSystem;
2917 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2918 const path = yield* Path.Path;2801 const path = yield* Path.Path;
2919 const host = yield* ProviderHost.ProviderHost;
2920 const selfInvocation = yield* resolveSelfInvocation();2802 const selfInvocation = yield* resolveSelfInvocation();
2921 const mockAgentPath = yield* path.fromFileUrl(2803 const mockAgentPath = yield* path.fromFileUrl(
2922 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2804 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -2979,8 +2861,7 @@ describe("AcpAdapterV2", () => {...@@ -2979,8 +2861,7 @@ describe("AcpAdapterV2", () => {
2979 },2861 },
2980 });2862 });
2981 const instanceId = ProviderInstanceId.make("acp-test-rollback-retry-generation");2863 const instanceId = ProviderInstanceId.make("acp-test-rollback-retry-generation");
2982 const adapter = makeAcpAdapterV2({2864 const adapter = yield* makeAcpAdapterV2({
2983 crypto: yield* Crypto.Crypto,
2984 instanceId,2865 instanceId,
2985 flavor: {2866 flavor: {
2986 driver: ACP_TEST_DRIVER,2867 driver: ACP_TEST_DRIVER,
...@@ -2998,9 +2879,6 @@ describe("AcpAdapterV2", () => {...@@ -2998,9 +2879,6 @@ describe("AcpAdapterV2", () => {
2998 }),2879 }),
2999 makeRuntime,2880 makeRuntime,
3000 },2881 },
3001 fileSystem,
3002 idAllocator,
3003 host,
3004 selfInvocation,2882 selfInvocation,
3005 continuationRequests: { offer: () => Effect.void },2883 continuationRequests: { offer: () => Effect.void },
3006 });2884 });
...@@ -3074,10 +2952,8 @@ describe("AcpAdapterV2", () => {...@@ -3074,10 +2952,8 @@ describe("AcpAdapterV2", () => {
3074 it.effect("keeps the original ACP session usable when a staged replacement terminates", () =>2952 it.effect("keeps the original ACP session usable when a staged replacement terminates", () =>
3075 Effect.gen(function* () {2953 Effect.gen(function* () {
3076 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;2954 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3077 const fileSystem = yield* FileSystem.FileSystem;
3078 const idAllocator = yield* IdAllocator.IdAllocatorV2;2955 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3079 const path = yield* Path.Path;2956 const path = yield* Path.Path;
3080 const host = yield* ProviderHost.ProviderHost;
3081 const selfInvocation = yield* resolveSelfInvocation();2957 const selfInvocation = yield* resolveSelfInvocation();
3082 const mockAgentPath = yield* path.fromFileUrl(2958 const mockAgentPath = yield* path.fromFileUrl(
3083 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),2959 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -3109,17 +2985,13 @@ describe("AcpAdapterV2", () => {...@@ -3109,17 +2985,13 @@ describe("AcpAdapterV2", () => {
3109 };2985 };
3110 });2986 });
3111 const instanceId = ProviderInstanceId.make("acp-test-rollback-failure-compensation");2987 const instanceId = ProviderInstanceId.make("acp-test-rollback-failure-compensation");
3112 const adapter = makeAcpAdapterV2({2988 const adapter = yield* makeAcpAdapterV2({
3113 crypto: yield* Crypto.Crypto,
3114 instanceId,2989 instanceId,
3115 flavor: {2990 flavor: {
3116 driver: ACP_TEST_DRIVER,2991 driver: ACP_TEST_DRIVER,
3117 capabilities: AcpProviderCapabilitiesV2,2992 capabilities: AcpProviderCapabilitiesV2,
3118 makeRuntime,2993 makeRuntime,
3119 },2994 },
3120 fileSystem,
3121 idAllocator,
3122 host,
3123 selfInvocation,2995 selfInvocation,
3124 });2996 });
3125 const threadId = ThreadId.make("thread-acp-rollback-failure-compensation");2997 const threadId = ThreadId.make("thread-acp-rollback-failure-compensation");
...@@ -3190,27 +3062,20 @@ describe("AcpAdapterV2", () => {...@@ -3190,27 +3062,20 @@ describe("AcpAdapterV2", () => {
3190 it.effect("closes an idle ACP session exactly once through the transition permit", () =>3062 it.effect("closes an idle ACP session exactly once through the transition permit", () =>
3191 Effect.gen(function* () {3063 Effect.gen(function* () {
3192 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3064 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3193 const fileSystem = yield* FileSystem.FileSystem;
3194 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3195 const path = yield* Path.Path;3065 const path = yield* Path.Path;
3196 const host = yield* ProviderHost.ProviderHost;
3197 const selfInvocation = yield* resolveSelfInvocation();3066 const selfInvocation = yield* resolveSelfInvocation();
3198 const mockAgentPath = yield* path.fromFileUrl(3067 const mockAgentPath = yield* path.fromFileUrl(
3199 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3068 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3200 );3069 );
3201 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);3070 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
3202 const instanceId = ProviderInstanceId.make("acp-test");3071 const instanceId = ProviderInstanceId.make("acp-test");
3203 const adapter = makeAcpAdapterV2({3072 const adapter = yield* makeAcpAdapterV2({
3204 crypto: yield* Crypto.Crypto,
3205 instanceId,3073 instanceId,
3206 flavor: {3074 flavor: {
3207 driver: ACP_TEST_DRIVER,3075 driver: ACP_TEST_DRIVER,
3208 capabilities: AcpProviderCapabilitiesV2,3076 capabilities: AcpProviderCapabilitiesV2,
3209 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),3077 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
3210 },3078 },
3211 fileSystem,
3212 idAllocator,
3213 host,
3214 selfInvocation,3079 selfInvocation,
3215 });3080 });
3216 const threadId = ThreadId.make("thread-acp-idle-finalizer");3081 const threadId = ThreadId.make("thread-acp-idle-finalizer");
...@@ -3241,26 +3106,18 @@ describe("AcpAdapterV2", () => {...@@ -3241,26 +3106,18 @@ describe("AcpAdapterV2", () => {
3241 (model) =>3106 (model) =>
3242 Effect.gen(function* () {3107 Effect.gen(function* () {
3243 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3108 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3244 const fileSystem = yield* FileSystem.FileSystem;
3245 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3246 const path = yield* Path.Path;3109 const path = yield* Path.Path;
3247 const host = yield* ProviderHost.ProviderHost;
3248 const selfInvocation = yield* resolveSelfInvocation();3110 const selfInvocation = yield* resolveSelfInvocation();
3249 const mockAgentPath = yield* path.fromFileUrl(3111 const mockAgentPath = yield* path.fromFileUrl(
3250 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3112 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3251 );3113 );
3252 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();3114 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3253 const instanceId = ProviderInstanceId.make("grok-test");3115 const instanceId = ProviderInstanceId.make("grok-test");
3254 const adapter = makeGrokAdapterV2({3116 const adapter = yield* makeGrokAdapterV2({
3255 instanceId,3117 instanceId,
3256 settings: DEFAULT_GROK_SETTINGS,3118 settings: DEFAULT_GROK_SETTINGS,
3257 environment: {},3119 environment: {},
3258 hostPlatform: yield* HostProcessPlatform,3120 hostPlatform: yield* HostProcessPlatform,
3259 childProcessSpawner,
3260 crypto: yield* Crypto.Crypto,
3261 fileSystem,
3262 idAllocator,
3263 host,
3264 selfInvocation: yield* resolveSelfInvocation(),3121 selfInvocation: yield* resolveSelfInvocation(),
3265 // Production Grok runtimes are wrapped by the x.ai prompt runtime.3122 // Production Grok runtimes are wrapped by the x.ai prompt runtime.
3266 makeRuntime: (input) =>3123 makeRuntime: (input) =>
...@@ -3296,26 +3153,18 @@ describe("AcpAdapterV2", () => {...@@ -3296,26 +3153,18 @@ describe("AcpAdapterV2", () => {
3296 it.live("Grok reapplies an explicit return to the session's setup-time model", () =>3153 it.live("Grok reapplies an explicit return to the session's setup-time model", () =>
3297 Effect.gen(function* () {3154 Effect.gen(function* () {
3298 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3155 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3299 const fileSystem = yield* FileSystem.FileSystem;
3300 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3301 const path = yield* Path.Path;3156 const path = yield* Path.Path;
3302 const host = yield* ProviderHost.ProviderHost;
3303 const selfInvocation = yield* resolveSelfInvocation();3157 const selfInvocation = yield* resolveSelfInvocation();
3304 const mockAgentPath = yield* path.fromFileUrl(3158 const mockAgentPath = yield* path.fromFileUrl(
3305 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3159 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3306 );3160 );
3307 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();3161 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3308 const instanceId = ProviderInstanceId.make("grok-test-switch-back");3162 const instanceId = ProviderInstanceId.make("grok-test-switch-back");
3309 const adapter = makeGrokAdapterV2({3163 const adapter = yield* makeGrokAdapterV2({
3310 instanceId,3164 instanceId,
3311 settings: DEFAULT_GROK_SETTINGS,3165 settings: DEFAULT_GROK_SETTINGS,
3312 environment: {},3166 environment: {},
3313 hostPlatform: yield* HostProcessPlatform,3167 hostPlatform: yield* HostProcessPlatform,
3314 childProcessSpawner,
3315 crypto: yield* Crypto.Crypto,
3316 fileSystem,
3317 idAllocator,
3318 host,
3319 selfInvocation: yield* resolveSelfInvocation(),3168 selfInvocation: yield* resolveSelfInvocation(),
3320 // Production Grok runtimes are wrapped by the x.ai prompt runtime.3169 // Production Grok runtimes are wrapped by the x.ai prompt runtime.
3321 makeRuntime: (input) =>3170 makeRuntime: (input) =>
...@@ -3377,26 +3226,19 @@ describe("AcpAdapterV2", () => {...@@ -3377,26 +3226,19 @@ describe("AcpAdapterV2", () => {
3377 it.effect("skips requested options that the active ACP session does not expose", () =>3226 it.effect("skips requested options that the active ACP session does not expose", () =>
3378 Effect.gen(function* () {3227 Effect.gen(function* () {
3379 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3228 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3380 const fileSystem = yield* FileSystem.FileSystem;
3381 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3382 const path = yield* Path.Path;3229 const path = yield* Path.Path;
3383 const host = yield* ProviderHost.ProviderHost;
3384 const selfInvocation = yield* resolveSelfInvocation();3230 const selfInvocation = yield* resolveSelfInvocation();
3385 const mockAgentPath = yield* path.fromFileUrl(3231 const mockAgentPath = yield* path.fromFileUrl(
3386 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3232 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3387 );3233 );
3388 const instanceId = ProviderInstanceId.make("acp-test");3234 const instanceId = ProviderInstanceId.make("acp-test");
3389 const adapter = makeAcpAdapterV2({3235 const adapter = yield* makeAcpAdapterV2({
3390 crypto: yield* Crypto.Crypto,
3391 instanceId,3236 instanceId,
3392 flavor: {3237 flavor: {
3393 driver: ACP_TEST_DRIVER,3238 driver: ACP_TEST_DRIVER,
3394 capabilities: AcpProviderCapabilitiesV2,3239 capabilities: AcpProviderCapabilitiesV2,
3395 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),3240 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath }),
3396 },3241 },
3397 fileSystem,
3398 idAllocator,
3399 host,
3400 selfInvocation,3242 selfInvocation,
3401 });3243 });
3402 const threadId = ThreadId.make("thread-acp-unsupported-option");3244 const threadId = ThreadId.make("thread-acp-unsupported-option");
...@@ -3426,27 +3268,20 @@ describe("AcpAdapterV2", () => {...@@ -3426,27 +3268,20 @@ describe("AcpAdapterV2", () => {
3426 it.effect("reconfigures a loaded ACP session from its own active setup metadata", () =>3268 it.effect("reconfigures a loaded ACP session from its own active setup metadata", () =>
3427 Effect.gen(function* () {3269 Effect.gen(function* () {
3428 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3270 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3429 const fileSystem = yield* FileSystem.FileSystem;
3430 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3431 const path = yield* Path.Path;3271 const path = yield* Path.Path;
3432 const host = yield* ProviderHost.ProviderHost;
3433 const selfInvocation = yield* resolveSelfInvocation();3272 const selfInvocation = yield* resolveSelfInvocation();
3434 const mockAgentPath = yield* path.fromFileUrl(3273 const mockAgentPath = yield* path.fromFileUrl(
3435 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3274 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3436 );3275 );
3437 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);3276 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
3438 const instanceId = ProviderInstanceId.make("acp-test");3277 const instanceId = ProviderInstanceId.make("acp-test");
3439 const adapter = makeAcpAdapterV2({3278 const adapter = yield* makeAcpAdapterV2({
3440 crypto: yield* Crypto.Crypto,
3441 instanceId,3279 instanceId,
3442 flavor: {3280 flavor: {
3443 driver: ACP_TEST_DRIVER,3281 driver: ACP_TEST_DRIVER,
3444 capabilities: AcpProviderCapabilitiesV2,3282 capabilities: AcpProviderCapabilitiesV2,
3445 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),3283 makeRuntime: makeMockRuntime({ childProcessSpawner, mockAgentPath, protocolEvents }),
3446 },3284 },
3447 fileSystem,
3448 idAllocator,
3449 host,
3450 selfInvocation,3285 selfInvocation,
3451 });3286 });
3452 const firstThreadId = ThreadId.make("thread-acp-active-setup:first");3287 const firstThreadId = ThreadId.make("thread-acp-active-setup:first");
...@@ -3537,18 +3372,15 @@ describe("AcpAdapterV2", () => {...@@ -3537,18 +3372,15 @@ describe("AcpAdapterV2", () => {
3537 it.live("terminalizes an empty successful foreground Bash tool when the turn completes", () =>3372 it.live("terminalizes an empty successful foreground Bash tool when the turn completes", () =>
3538 Effect.gen(function* () {3373 Effect.gen(function* () {
3539 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3374 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3540 const fileSystem = yield* FileSystem.FileSystem;
3541 const idAllocator = yield* IdAllocator.IdAllocatorV2;3375 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3542 const path = yield* Path.Path;3376 const path = yield* Path.Path;
3543 const host = yield* ProviderHost.ProviderHost;
3544 const selfInvocation = yield* resolveSelfInvocation();3377 const selfInvocation = yield* resolveSelfInvocation();
3545 const mockAgentPath = yield* path.fromFileUrl(3378 const mockAgentPath = yield* path.fromFileUrl(
3546 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3379 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3547 );3380 );
3548 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);3381 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
3549 const instanceId = ProviderInstanceId.make("acp-test");3382 const instanceId = ProviderInstanceId.make("acp-test");
3550 const adapter = makeAcpAdapterV2({3383 const adapter = yield* makeAcpAdapterV2({
3551 crypto: yield* Crypto.Crypto,
3552 instanceId,3384 instanceId,
3553 flavor: {3385 flavor: {
3554 driver: ACP_TEST_DRIVER,3386 driver: ACP_TEST_DRIVER,
...@@ -3565,9 +3397,6 @@ describe("AcpAdapterV2", () => {...@@ -3565,9 +3397,6 @@ describe("AcpAdapterV2", () => {
3565 restartRuntimeAfterInterrupt: true,3397 restartRuntimeAfterInterrupt: true,
3566 terminateRuntimeProcessGroupOnInterrupt: true,3398 terminateRuntimeProcessGroupOnInterrupt: true,
3567 },3399 },
3568 fileSystem,
3569 idAllocator,
3570 host,
3571 selfInvocation,3400 selfInvocation,
3572 });3401 });
3573 const threadId = ThreadId.make("thread-acp-empty-successful-bash");3402 const threadId = ThreadId.make("thread-acp-empty-successful-bash");
...@@ -3684,16 +3513,12 @@ describe("AcpAdapterV2", () => {...@@ -3684,16 +3513,12 @@ describe("AcpAdapterV2", () => {
3684 it.effect("drains native ACP cancellation before admitting the next prompt", () =>3513 it.effect("drains native ACP cancellation before admitting the next prompt", () =>
3685 Effect.gen(function* () {3514 Effect.gen(function* () {
3686 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3515 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3687 const fileSystem = yield* FileSystem.FileSystem;
3688 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3689 const path = yield* Path.Path;3516 const path = yield* Path.Path;
3690 const host = yield* ProviderHost.ProviderHost;
3691 const selfInvocation = yield* resolveSelfInvocation();3517 const selfInvocation = yield* resolveSelfInvocation();
3692 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();3518 const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3693 const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};3519 const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};
3694 const instanceId = ProviderInstanceId.make("acp-native-cancel");3520 const instanceId = ProviderInstanceId.make("acp-native-cancel");
3695 const adapter = makeAcpAdapterV2({3521 const adapter = yield* makeAcpAdapterV2({
3696 crypto: yield* Crypto.Crypto,
3697 instanceId,3522 instanceId,
3698 flavor: {3523 flavor: {
3699 driver: ACP_TEST_DRIVER,3524 driver: ACP_TEST_DRIVER,
...@@ -3712,9 +3537,6 @@ describe("AcpAdapterV2", () => {...@@ -3712,9 +3537,6 @@ describe("AcpAdapterV2", () => {
3712 },3537 },
3713 }),3538 }),
3714 },3539 },
3715 fileSystem,
3716 idAllocator,
3717 host,
3718 selfInvocation,3540 selfInvocation,
3719 });3541 });
3720 const threadId = ThreadId.make("thread-acp-native-cancel");3542 const threadId = ThreadId.make("thread-acp-native-cancel");
...@@ -3798,18 +3620,14 @@ describe("AcpAdapterV2", () => {...@@ -3798,18 +3620,14 @@ describe("AcpAdapterV2", () => {
3798 it.effect("cancels pending permission requests while interrupting an ACP turn", () =>3620 it.effect("cancels pending permission requests while interrupting an ACP turn", () =>
3799 Effect.gen(function* () {3621 Effect.gen(function* () {
3800 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3622 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3801 const fileSystem = yield* FileSystem.FileSystem;
3802 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3803 const path = yield* Path.Path;3623 const path = yield* Path.Path;
3804 const host = yield* ProviderHost.ProviderHost;
3805 const selfInvocation = yield* resolveSelfInvocation();3624 const selfInvocation = yield* resolveSelfInvocation();
3806 const mockAgentPath = yield* path.fromFileUrl(3625 const mockAgentPath = yield* path.fromFileUrl(
3807 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3626 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3808 );3627 );
3809 const releaseCancel = yield* Deferred.make<void>();3628 const releaseCancel = yield* Deferred.make<void>();
3810 const instanceId = ProviderInstanceId.make("acp-test");3629 const instanceId = ProviderInstanceId.make("acp-test");
3811 const adapter = makeAcpAdapterV2({3630 const adapter = yield* makeAcpAdapterV2({
3812 crypto: yield* Crypto.Crypto,
3813 instanceId,3631 instanceId,
3814 flavor: {3632 flavor: {
3815 driver: ACP_TEST_DRIVER,3633 driver: ACP_TEST_DRIVER,
...@@ -3821,9 +3639,6 @@ describe("AcpAdapterV2", () => {...@@ -3821,9 +3639,6 @@ describe("AcpAdapterV2", () => {
3821 wrapCancel: (cancel) => Deferred.await(releaseCancel).pipe(Effect.andThen(cancel)),3639 wrapCancel: (cancel) => Deferred.await(releaseCancel).pipe(Effect.andThen(cancel)),
3822 }),3640 }),
3823 },3641 },
3824 fileSystem,
3825 idAllocator,
3826 host,
3827 selfInvocation,3642 selfInvocation,
3828 });3643 });
3829 const threadId = ThreadId.make("thread-acp-cancel-permission");3644 const threadId = ThreadId.make("thread-acp-cancel-permission");
...@@ -3899,10 +3714,7 @@ describe("AcpAdapterV2", () => {...@@ -3899,10 +3714,7 @@ describe("AcpAdapterV2", () => {
3899 it.live("keeps hard teardown excluded until a permission response is enqueued", () =>3714 it.live("keeps hard teardown excluded until a permission response is enqueued", () =>
3900 Effect.gen(function* () {3715 Effect.gen(function* () {
3901 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3716 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3902 const fileSystem = yield* FileSystem.FileSystem;
3903 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3904 const path = yield* Path.Path;3717 const path = yield* Path.Path;
3905 const host = yield* ProviderHost.ProviderHost;
3906 const selfInvocation = yield* resolveSelfInvocation();3718 const selfInvocation = yield* resolveSelfInvocation();
3907 const mockAgentPath = yield* path.fromFileUrl(3719 const mockAgentPath = yield* path.fromFileUrl(
3908 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3720 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -3910,8 +3722,7 @@ describe("AcpAdapterV2", () => {...@@ -3910,8 +3722,7 @@ describe("AcpAdapterV2", () => {
3910 const responseEnqueued = yield* Deferred.make<void>();3722 const responseEnqueued = yield* Deferred.make<void>();
3911 const releaseResponseAcknowledgement = yield* Deferred.make<void>();3723 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
3912 const instanceId = ProviderInstanceId.make("acp-test");3724 const instanceId = ProviderInstanceId.make("acp-test");
3913 const adapter = makeAcpAdapterV2({3725 const adapter = yield* makeAcpAdapterV2({
3914 crypto: yield* Crypto.Crypto,
3915 instanceId,3726 instanceId,
3916 flavor: {3727 flavor: {
3917 driver: ACP_TEST_DRIVER,3728 driver: ACP_TEST_DRIVER,
...@@ -3927,9 +3738,6 @@ describe("AcpAdapterV2", () => {...@@ -3927,9 +3738,6 @@ describe("AcpAdapterV2", () => {
3927 ),3738 ),
3928 }),3739 }),
3929 },3740 },
3930 fileSystem,
3931 idAllocator,
3932 host,
3933 selfInvocation,3741 selfInvocation,
3934 });3742 });
3935 const threadId = ThreadId.make("thread-acp-response-wins-permission");3743 const threadId = ThreadId.make("thread-acp-response-wins-permission");
...@@ -3998,10 +3806,7 @@ describe("AcpAdapterV2", () => {...@@ -3998,10 +3806,7 @@ describe("AcpAdapterV2", () => {
3998 it.live("carries elicitation request identity through the completed stdout write", () =>3806 it.live("carries elicitation request identity through the completed stdout write", () =>
3999 Effect.gen(function* () {3807 Effect.gen(function* () {
4000 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3808 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4001 const fileSystem = yield* FileSystem.FileSystem;
4002 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4003 const path = yield* Path.Path;3809 const path = yield* Path.Path;
4004 const host = yield* ProviderHost.ProviderHost;
4005 const selfInvocation = yield* resolveSelfInvocation();3810 const selfInvocation = yield* resolveSelfInvocation();
4006 const mockAgentPath = yield* path.fromFileUrl(3811 const mockAgentPath = yield* path.fromFileUrl(
4007 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3812 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4009,8 +3814,7 @@ describe("AcpAdapterV2", () => {...@@ -4009,8 +3814,7 @@ describe("AcpAdapterV2", () => {
4009 const responseWritten = yield* Deferred.make<void>();3814 const responseWritten = yield* Deferred.make<void>();
4010 const releaseResponseAcknowledgement = yield* Deferred.make<void>();3815 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
4011 const instanceId = ProviderInstanceId.make("acp-test-reordered-elicitation");3816 const instanceId = ProviderInstanceId.make("acp-test-reordered-elicitation");
4012 const adapter = makeAcpAdapterV2({3817 const adapter = yield* makeAcpAdapterV2({
4013 crypto: yield* Crypto.Crypto,
4014 instanceId,3818 instanceId,
4015 flavor: {3819 flavor: {
4016 driver: ACP_TEST_DRIVER,3820 driver: ACP_TEST_DRIVER,
...@@ -4026,9 +3830,6 @@ describe("AcpAdapterV2", () => {...@@ -4026,9 +3830,6 @@ describe("AcpAdapterV2", () => {
4026 ),3830 ),
4027 }),3831 }),
4028 },3832 },
4029 fileSystem,
4030 idAllocator,
4031 host,
4032 selfInvocation,3833 selfInvocation,
4033 });3834 });
4034 const threadId = ThreadId.make("thread-acp-reordered-elicitation");3835 const threadId = ThreadId.make("thread-acp-reordered-elicitation");
...@@ -4087,17 +3888,13 @@ describe("AcpAdapterV2", () => {...@@ -4087,17 +3888,13 @@ describe("AcpAdapterV2", () => {
4087 it.live("auto-approves tagged MCP elicitations under full-access policy", () =>3888 it.live("auto-approves tagged MCP elicitations under full-access policy", () =>
4088 Effect.gen(function* () {3889 Effect.gen(function* () {
4089 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3890 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4090 const fileSystem = yield* FileSystem.FileSystem;
4091 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4092 const path = yield* Path.Path;3891 const path = yield* Path.Path;
4093 const host = yield* ProviderHost.ProviderHost;
4094 const selfInvocation = yield* resolveSelfInvocation();3892 const selfInvocation = yield* resolveSelfInvocation();
4095 const mockAgentPath = yield* path.fromFileUrl(3893 const mockAgentPath = yield* path.fromFileUrl(
4096 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3894 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4097 );3895 );
4098 const instanceId = ProviderInstanceId.make("acp-test-mcp-approval-elicitation");3896 const instanceId = ProviderInstanceId.make("acp-test-mcp-approval-elicitation");
4099 const adapter = makeAcpAdapterV2({3897 const adapter = yield* makeAcpAdapterV2({
4100 crypto: yield* Crypto.Crypto,
4101 instanceId,3898 instanceId,
4102 flavor: {3899 flavor: {
4103 driver: ACP_TEST_DRIVER,3900 driver: ACP_TEST_DRIVER,
...@@ -4108,9 +3905,6 @@ describe("AcpAdapterV2", () => {...@@ -4108,9 +3905,6 @@ describe("AcpAdapterV2", () => {
4108 environment: { T3_ACP_EMIT_MCP_TOOL_APPROVAL_ELICITATION: "1" },3905 environment: { T3_ACP_EMIT_MCP_TOOL_APPROVAL_ELICITATION: "1" },
4109 }),3906 }),
4110 },3907 },
4111 fileSystem,
4112 idAllocator,
4113 host,
4114 selfInvocation,3908 selfInvocation,
4115 });3909 });
4116 const threadId = ThreadId.make("thread-acp-mcp-approval-elicitation");3910 const threadId = ThreadId.make("thread-acp-mcp-approval-elicitation");
...@@ -4155,10 +3949,7 @@ describe("AcpAdapterV2", () => {...@@ -4155,10 +3949,7 @@ describe("AcpAdapterV2", () => {
4155 it.live("fails a held native response acknowledgement before normal session close", () =>3949 it.live("fails a held native response acknowledgement before normal session close", () =>
4156 Effect.gen(function* () {3950 Effect.gen(function* () {
4157 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;3951 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4158 const fileSystem = yield* FileSystem.FileSystem;
4159 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4160 const path = yield* Path.Path;3952 const path = yield* Path.Path;
4161 const host = yield* ProviderHost.ProviderHost;
4162 const selfInvocation = yield* resolveSelfInvocation();3953 const selfInvocation = yield* resolveSelfInvocation();
4163 const mockAgentPath = yield* path.fromFileUrl(3954 const mockAgentPath = yield* path.fromFileUrl(
4164 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),3955 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4167,8 +3958,7 @@ describe("AcpAdapterV2", () => {...@@ -4167,8 +3958,7 @@ describe("AcpAdapterV2", () => {
4167 const releaseResponseAcknowledgement = yield* Deferred.make<void>();3958 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
4168 const responseLifecycle: Array<string> = [];3959 const responseLifecycle: Array<string> = [];
4169 const instanceId = ProviderInstanceId.make("acp-test-normal-close-held-response");3960 const instanceId = ProviderInstanceId.make("acp-test-normal-close-held-response");
4170 const adapter = makeAcpAdapterV2({3961 const adapter = yield* makeAcpAdapterV2({
4171 crypto: yield* Crypto.Crypto,
4172 instanceId,3962 instanceId,
4173 flavor: {3963 flavor: {
4174 driver: ACP_TEST_DRIVER,3964 driver: ACP_TEST_DRIVER,
...@@ -4184,9 +3974,6 @@ describe("AcpAdapterV2", () => {...@@ -4184,9 +3974,6 @@ describe("AcpAdapterV2", () => {
4184 ),3974 ),
4185 }),3975 }),
4186 },3976 },
4187 fileSystem,
4188 idAllocator,
4189 host,
4190 selfInvocation,3977 selfInvocation,
4191 testHooks: {3978 testHooks: {
4192 onNativeResponseLifecycle: (event) =>3979 onNativeResponseLifecycle: (event) =>
...@@ -4263,10 +4050,7 @@ describe("AcpAdapterV2", () => {...@@ -4263,10 +4050,7 @@ describe("AcpAdapterV2", () => {
4263 it.live("rejects delayed native response registration when normal close wins the permit", () =>4050 it.live("rejects delayed native response registration when normal close wins the permit", () =>
4264 Effect.gen(function* () {4051 Effect.gen(function* () {
4265 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4052 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4266 const fileSystem = yield* FileSystem.FileSystem;
4267 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4268 const path = yield* Path.Path;4053 const path = yield* Path.Path;
4269 const host = yield* ProviderHost.ProviderHost;
4270 const selfInvocation = yield* resolveSelfInvocation();4054 const selfInvocation = yield* resolveSelfInvocation();
4271 const mockAgentPath = yield* path.fromFileUrl(4055 const mockAgentPath = yield* path.fromFileUrl(
4272 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4056 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4277,8 +4061,7 @@ describe("AcpAdapterV2", () => {...@@ -4277,8 +4061,7 @@ describe("AcpAdapterV2", () => {
4277 const releaseTransportClose = yield* Deferred.make<void>();4061 const releaseTransportClose = yield* Deferred.make<void>();
4278 const responseLifecycle: Array<string> = [];4062 const responseLifecycle: Array<string> = [];
4279 const instanceId = ProviderInstanceId.make("acp-test-close-wins-registration");4063 const instanceId = ProviderInstanceId.make("acp-test-close-wins-registration");
4280 const adapter = makeAcpAdapterV2({4064 const adapter = yield* makeAcpAdapterV2({
4281 crypto: yield* Crypto.Crypto,
4282 instanceId,4065 instanceId,
4283 flavor: {4066 flavor: {
4284 driver: ACP_TEST_DRIVER,4067 driver: ACP_TEST_DRIVER,
...@@ -4289,9 +4072,6 @@ describe("AcpAdapterV2", () => {...@@ -4289,9 +4072,6 @@ describe("AcpAdapterV2", () => {
4289 environment: { T3_ACP_EMIT_TOOL_CALLS: "1" },4072 environment: { T3_ACP_EMIT_TOOL_CALLS: "1" },
4290 }),4073 }),
4291 },4074 },
4292 fileSystem,
4293 idAllocator,
4294 host,
4295 selfInvocation,4075 selfInvocation,
4296 testHooks: {4076 testHooks: {
4297 afterNativeResponseTransportClosed: () =>4077 afterNativeResponseTransportClosed: () =>
...@@ -4377,10 +4157,7 @@ describe("AcpAdapterV2", () => {...@@ -4377,10 +4157,7 @@ describe("AcpAdapterV2", () => {
4377 it.live("bounds a missing pending permission response acknowledgement", () =>4157 it.live("bounds a missing pending permission response acknowledgement", () =>
4378 Effect.gen(function* () {4158 Effect.gen(function* () {
4379 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4159 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4380 const fileSystem = yield* FileSystem.FileSystem;
4381 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4382 const path = yield* Path.Path;4160 const path = yield* Path.Path;
4383 const host = yield* ProviderHost.ProviderHost;
4384 const selfInvocation = yield* resolveSelfInvocation();4161 const selfInvocation = yield* resolveSelfInvocation();
4385 const mockAgentPath = yield* path.fromFileUrl(4162 const mockAgentPath = yield* path.fromFileUrl(
4386 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4163 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4390,8 +4167,7 @@ describe("AcpAdapterV2", () => {...@@ -4390,8 +4167,7 @@ describe("AcpAdapterV2", () => {
4390 const responseLifecycle: Array<string> = [];4167 const responseLifecycle: Array<string> = [];
4391 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);4168 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
4392 const instanceId = ProviderInstanceId.make("acp-test-pending-response-timeout");4169 const instanceId = ProviderInstanceId.make("acp-test-pending-response-timeout");
4393 const adapter = makeAcpAdapterV2({4170 const adapter = yield* makeAcpAdapterV2({
4394 crypto: yield* Crypto.Crypto,
4395 instanceId,4171 instanceId,
4396 flavor: {4172 flavor: {
4397 driver: ACP_TEST_DRIVER,4173 driver: ACP_TEST_DRIVER,
...@@ -4423,9 +4199,6 @@ describe("AcpAdapterV2", () => {...@@ -4423,9 +4199,6 @@ describe("AcpAdapterV2", () => {
4423 ),4199 ),
4424 }),4200 }),
4425 },4201 },
4426 fileSystem,
4427 idAllocator,
4428 host,
4429 selfInvocation,4202 selfInvocation,
4430 testHooks: {4203 testHooks: {
4431 onNativeResponseLifecycle: (event) =>4204 onNativeResponseLifecycle: (event) =>
...@@ -4518,10 +4291,7 @@ describe("AcpAdapterV2", () => {...@@ -4518,10 +4291,7 @@ describe("AcpAdapterV2", () => {
4518 it.live("defers caller cancellation until a pending response acknowledgement is bounded", () =>4291 it.live("defers caller cancellation until a pending response acknowledgement is bounded", () =>
4519 Effect.gen(function* () {4292 Effect.gen(function* () {
4520 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4293 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4521 const fileSystem = yield* FileSystem.FileSystem;
4522 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4523 const path = yield* Path.Path;4294 const path = yield* Path.Path;
4524 const host = yield* ProviderHost.ProviderHost;
4525 const selfInvocation = yield* resolveSelfInvocation();4295 const selfInvocation = yield* resolveSelfInvocation();
4526 const mockAgentPath = yield* path.fromFileUrl(4296 const mockAgentPath = yield* path.fromFileUrl(
4527 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4297 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4529,8 +4299,7 @@ describe("AcpAdapterV2", () => {...@@ -4529,8 +4299,7 @@ describe("AcpAdapterV2", () => {
4529 const responseEnqueued = yield* Deferred.make<void>();4299 const responseEnqueued = yield* Deferred.make<void>();
4530 const releaseNativeHook = yield* Deferred.make<void>();4300 const releaseNativeHook = yield* Deferred.make<void>();
4531 const instanceId = ProviderInstanceId.make("acp-test-pending-response-cancel");4301 const instanceId = ProviderInstanceId.make("acp-test-pending-response-cancel");
4532 const adapter = makeAcpAdapterV2({4302 const adapter = yield* makeAcpAdapterV2({
4533 crypto: yield* Crypto.Crypto,
4534 instanceId,4303 instanceId,
4535 flavor: {4304 flavor: {
4536 driver: ACP_TEST_DRIVER,4305 driver: ACP_TEST_DRIVER,
...@@ -4561,9 +4330,6 @@ describe("AcpAdapterV2", () => {...@@ -4561,9 +4330,6 @@ describe("AcpAdapterV2", () => {
4561 ),4330 ),
4562 }),4331 }),
4563 },4332 },
4564 fileSystem,
4565 idAllocator,
4566 host,
4567 selfInvocation,4333 selfInvocation,
4568 });4334 });
4569 const threadId = ThreadId.make("thread-acp-pending-response-cancel");4335 const threadId = ThreadId.make("thread-acp-pending-response-cancel");
...@@ -4634,10 +4400,8 @@ describe("AcpAdapterV2", () => {...@@ -4634,10 +4400,8 @@ describe("AcpAdapterV2", () => {
4634 it.live("waits for immediate allow and deny permission responses before hard teardown", () =>4400 it.live("waits for immediate allow and deny permission responses before hard teardown", () =>
4635 Effect.gen(function* () {4401 Effect.gen(function* () {
4636 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4402 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4637 const fileSystem = yield* FileSystem.FileSystem;
4638 const idAllocator = yield* IdAllocator.IdAllocatorV2;4403 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4639 const path = yield* Path.Path;4404 const path = yield* Path.Path;
4640 const host = yield* ProviderHost.ProviderHost;
4641 const selfInvocation = yield* resolveSelfInvocation();4405 const selfInvocation = yield* resolveSelfInvocation();
4642 const mockAgentPath = yield* path.fromFileUrl(4406 const mockAgentPath = yield* path.fromFileUrl(
4643 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4407 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4651,8 +4415,7 @@ describe("AcpAdapterV2", () => {...@@ -4651,8 +4415,7 @@ describe("AcpAdapterV2", () => {
4651 const responseEnqueued = yield* Deferred.make<void>();4415 const responseEnqueued = yield* Deferred.make<void>();
4652 const releaseResponseAcknowledgement = yield* Deferred.make<void>();4416 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
4653 const instanceId = ProviderInstanceId.make(`acp-test-${name}`);4417 const instanceId = ProviderInstanceId.make(`acp-test-${name}`);
4654 const adapter = makeAcpAdapterV2({4418 const adapter = yield* makeAcpAdapterV2({
4655 crypto: yield* Crypto.Crypto,
4656 instanceId,4419 instanceId,
4657 flavor: {4420 flavor: {
4658 driver: ACP_TEST_DRIVER,4421 driver: ACP_TEST_DRIVER,
...@@ -4676,9 +4439,6 @@ describe("AcpAdapterV2", () => {...@@ -4676,9 +4439,6 @@ describe("AcpAdapterV2", () => {
4676 ),4439 ),
4677 }),4440 }),
4678 },4441 },
4679 fileSystem,
4680 idAllocator,
4681 host,
4682 selfInvocation,4442 selfInvocation,
4683 });4443 });
4684 const threadId = ThreadId.make(`thread-acp-immediate-permission-${name}`);4444 const threadId = ThreadId.make(`thread-acp-immediate-permission-${name}`);
...@@ -4739,10 +4499,8 @@ describe("AcpAdapterV2", () => {...@@ -4739,10 +4499,8 @@ describe("AcpAdapterV2", () => {
4739 it.live("waits for immediate URL elicitation responses before hard teardown", () =>4499 it.live("waits for immediate URL elicitation responses before hard teardown", () =>
4740 Effect.gen(function* () {4500 Effect.gen(function* () {
4741 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4501 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4742 const fileSystem = yield* FileSystem.FileSystem;
4743 const idAllocator = yield* IdAllocator.IdAllocatorV2;4502 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4744 const path = yield* Path.Path;4503 const path = yield* Path.Path;
4745 const host = yield* ProviderHost.ProviderHost;
4746 const selfInvocation = yield* resolveSelfInvocation();4504 const selfInvocation = yield* resolveSelfInvocation();
4747 const mockAgentPath = yield* path.fromFileUrl(4505 const mockAgentPath = yield* path.fromFileUrl(
4748 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4506 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4750,8 +4508,7 @@ describe("AcpAdapterV2", () => {...@@ -4750,8 +4508,7 @@ describe("AcpAdapterV2", () => {
4750 const responseEnqueued = yield* Deferred.make<void>();4508 const responseEnqueued = yield* Deferred.make<void>();
4751 const releaseResponseAcknowledgement = yield* Deferred.make<void>();4509 const releaseResponseAcknowledgement = yield* Deferred.make<void>();
4752 const instanceId = ProviderInstanceId.make("acp-test-url-elicitation");4510 const instanceId = ProviderInstanceId.make("acp-test-url-elicitation");
4753 const adapter = makeAcpAdapterV2({4511 const adapter = yield* makeAcpAdapterV2({
4754 crypto: yield* Crypto.Crypto,
4755 instanceId,4512 instanceId,
4756 flavor: {4513 flavor: {
4757 driver: ACP_TEST_DRIVER,4514 driver: ACP_TEST_DRIVER,
...@@ -4775,9 +4532,6 @@ describe("AcpAdapterV2", () => {...@@ -4775,9 +4532,6 @@ describe("AcpAdapterV2", () => {
4775 ),4532 ),
4776 }),4533 }),
4777 },4534 },
4778 fileSystem,
4779 idAllocator,
4780 host,
4781 selfInvocation,4535 selfInvocation,
4782 });4536 });
4783 const threadId = ThreadId.make("thread-acp-immediate-url-elicitation");4537 const threadId = ThreadId.make("thread-acp-immediate-url-elicitation");
...@@ -4832,10 +4586,8 @@ describe("AcpAdapterV2", () => {...@@ -4832,10 +4586,8 @@ describe("AcpAdapterV2", () => {
4832 it.live("bounds a missing immediate response acknowledgement before hard teardown", () =>4586 it.live("bounds a missing immediate response acknowledgement before hard teardown", () =>
4833 Effect.gen(function* () {4587 Effect.gen(function* () {
4834 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4588 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4835 const fileSystem = yield* FileSystem.FileSystem;
4836 const idAllocator = yield* IdAllocator.IdAllocatorV2;4589 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4837 const path = yield* Path.Path;4590 const path = yield* Path.Path;
4838 const host = yield* ProviderHost.ProviderHost;
4839 const selfInvocation = yield* resolveSelfInvocation();4591 const selfInvocation = yield* resolveSelfInvocation();
4840 const mockAgentPath = yield* path.fromFileUrl(4592 const mockAgentPath = yield* path.fromFileUrl(
4841 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4593 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4843,8 +4595,7 @@ describe("AcpAdapterV2", () => {...@@ -4843,8 +4595,7 @@ describe("AcpAdapterV2", () => {
4843 const responseEnqueued = yield* Deferred.make<void>();4595 const responseEnqueued = yield* Deferred.make<void>();
4844 const releaseNativeHook = yield* Deferred.make<void>();4596 const releaseNativeHook = yield* Deferred.make<void>();
4845 const instanceId = ProviderInstanceId.make("acp-test-missing-response-ack");4597 const instanceId = ProviderInstanceId.make("acp-test-missing-response-ack");
4846 const adapter = makeAcpAdapterV2({4598 const adapter = yield* makeAcpAdapterV2({
4847 crypto: yield* Crypto.Crypto,
4848 instanceId,4599 instanceId,
4849 flavor: {4600 flavor: {
4850 driver: ACP_TEST_DRIVER,4601 driver: ACP_TEST_DRIVER,
...@@ -4872,9 +4623,6 @@ describe("AcpAdapterV2", () => {...@@ -4872,9 +4623,6 @@ describe("AcpAdapterV2", () => {
4872 ),4623 ),
4873 }),4624 }),
4874 },4625 },
4875 fileSystem,
4876 idAllocator,
4877 host,
4878 selfInvocation,4626 selfInvocation,
4879 });4627 });
4880 const threadId = ThreadId.make("thread-acp-missing-response-ack");4628 const threadId = ThreadId.make("thread-acp-missing-response-ack");
...@@ -4925,10 +4673,7 @@ describe("AcpAdapterV2", () => {...@@ -4925,10 +4673,7 @@ describe("AcpAdapterV2", () => {
4925 it.live("rejects an elicitation response when hard teardown wins admission", () =>4673 it.live("rejects an elicitation response when hard teardown wins admission", () =>
4926 Effect.gen(function* () {4674 Effect.gen(function* () {
4927 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4675 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4928 const fileSystem = yield* FileSystem.FileSystem;
4929 const idAllocator = yield* IdAllocator.IdAllocatorV2;
4930 const path = yield* Path.Path;4676 const path = yield* Path.Path;
4931 const host = yield* ProviderHost.ProviderHost;
4932 const selfInvocation = yield* resolveSelfInvocation();4677 const selfInvocation = yield* resolveSelfInvocation();
4933 const mockAgentPath = yield* path.fromFileUrl(4678 const mockAgentPath = yield* path.fromFileUrl(
4934 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4679 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -4936,8 +4681,7 @@ describe("AcpAdapterV2", () => {...@@ -4936,8 +4681,7 @@ describe("AcpAdapterV2", () => {
4936 const teardownStarted = yield* Deferred.make<void>();4681 const teardownStarted = yield* Deferred.make<void>();
4937 const releaseTeardown = yield* Deferred.make<void>();4682 const releaseTeardown = yield* Deferred.make<void>();
4938 const instanceId = ProviderInstanceId.make("acp-test");4683 const instanceId = ProviderInstanceId.make("acp-test");
4939 const adapter = makeAcpAdapterV2({4684 const adapter = yield* makeAcpAdapterV2({
4940 crypto: yield* Crypto.Crypto,
4941 instanceId,4685 instanceId,
4942 flavor: {4686 flavor: {
4943 driver: ACP_TEST_DRIVER,4687 driver: ACP_TEST_DRIVER,
...@@ -4961,9 +4705,6 @@ describe("AcpAdapterV2", () => {...@@ -4961,9 +4705,6 @@ describe("AcpAdapterV2", () => {
4961 ),4705 ),
4962 }),4706 }),
4963 },4707 },
4964 fileSystem,
4965 idAllocator,
4966 host,
4967 selfInvocation,4708 selfInvocation,
4968 });4709 });
4969 const threadId = ThreadId.make("thread-acp-teardown-wins-elicitation");4710 const threadId = ThreadId.make("thread-acp-teardown-wins-elicitation");
...@@ -5038,18 +4779,15 @@ describe("AcpAdapterV2", () => {...@@ -5038,18 +4779,15 @@ describe("AcpAdapterV2", () => {
5038 it.effect("releases an ACP turn when cancellation times out", () =>4779 it.effect("releases an ACP turn when cancellation times out", () =>
5039 Effect.gen(function* () {4780 Effect.gen(function* () {
5040 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4781 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5041 const fileSystem = yield* FileSystem.FileSystem;
5042 const idAllocator = yield* IdAllocator.IdAllocatorV2;4782 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5043 const path = yield* Path.Path;4783 const path = yield* Path.Path;
5044 const host = yield* ProviderHost.ProviderHost;
5045 const selfInvocation = yield* resolveSelfInvocation();4784 const selfInvocation = yield* resolveSelfInvocation();
5046 const mockAgentPath = yield* path.fromFileUrl(4785 const mockAgentPath = yield* path.fromFileUrl(
5047 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4786 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5048 );4787 );
5049 const instanceId = ProviderInstanceId.make("acp-test");4788 const instanceId = ProviderInstanceId.make("acp-test");
5050 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);4789 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5051 const adapter = makeAcpAdapterV2({4790 const adapter = yield* makeAcpAdapterV2({
5052 crypto: yield* Crypto.Crypto,
5053 instanceId,4791 instanceId,
5054 flavor: {4792 flavor: {
5055 driver: ACP_TEST_DRIVER,4793 driver: ACP_TEST_DRIVER,
...@@ -5061,9 +4799,6 @@ describe("AcpAdapterV2", () => {...@@ -5061,9 +4799,6 @@ describe("AcpAdapterV2", () => {
5061 protocolEvents,4799 protocolEvents,
5062 }),4800 }),
5063 },4801 },
5064 fileSystem,
5065 idAllocator,
5066 host,
5067 selfInvocation,4802 selfInvocation,
5068 });4803 });
5069 const threadId = ThreadId.make("thread-acp-cancel-timeout");4804 const threadId = ThreadId.make("thread-acp-cancel-timeout");
...@@ -5141,18 +4876,15 @@ describe("AcpAdapterV2", () => {...@@ -5141,18 +4876,15 @@ describe("AcpAdapterV2", () => {
5141 it.live("treats a second hard Stop as success when the turn is already gone", () =>4876 it.live("treats a second hard Stop as success when the turn is already gone", () =>
5142 Effect.gen(function* () {4877 Effect.gen(function* () {
5143 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4878 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5144 const fileSystem = yield* FileSystem.FileSystem;
5145 const idAllocator = yield* IdAllocator.IdAllocatorV2;4879 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5146 const path = yield* Path.Path;4880 const path = yield* Path.Path;
5147 const host = yield* ProviderHost.ProviderHost;
5148 const selfInvocation = yield* resolveSelfInvocation();4881 const selfInvocation = yield* resolveSelfInvocation();
5149 const mockAgentPath = yield* path.fromFileUrl(4882 const mockAgentPath = yield* path.fromFileUrl(
5150 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4883 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5151 );4884 );
5152 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);4885 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5153 const instanceId = ProviderInstanceId.make("acp-test");4886 const instanceId = ProviderInstanceId.make("acp-test");
5154 const adapter = makeAcpAdapterV2({4887 const adapter = yield* makeAcpAdapterV2({
5155 crypto: yield* Crypto.Crypto,
5156 instanceId,4888 instanceId,
5157 flavor: {4889 flavor: {
5158 driver: ACP_TEST_DRIVER,4890 driver: ACP_TEST_DRIVER,
...@@ -5168,9 +4900,6 @@ describe("AcpAdapterV2", () => {...@@ -5168,9 +4900,6 @@ describe("AcpAdapterV2", () => {
5168 protocolEvents,4900 protocolEvents,
5169 }),4901 }),
5170 },4902 },
5171 fileSystem,
5172 idAllocator,
5173 host,
5174 selfInvocation,4903 selfInvocation,
5175 });4904 });
5176 const threadId = ThreadId.make("thread-acp-double-stop");4905 const threadId = ThreadId.make("thread-acp-double-stop");
...@@ -5239,22 +4968,19 @@ describe("AcpAdapterV2", () => {...@@ -5239,22 +4968,19 @@ describe("AcpAdapterV2", () => {
5239 it.effect("finalizes a settled turn held open for background work when interrupted", () =>4968 it.effect("finalizes a settled turn held open for background work when interrupted", () =>
5240 Effect.gen(function* () {4969 Effect.gen(function* () {
5241 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;4970 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5242 const fileSystem = yield* FileSystem.FileSystem;
5243 const idAllocator = yield* IdAllocator.IdAllocatorV2;4971 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5244 const path = yield* Path.Path;4972 const path = yield* Path.Path;
5245 const host = yield* ProviderHost.ProviderHost;
5246 const selfInvocation = yield* resolveSelfInvocation();4973 const selfInvocation = yield* resolveSelfInvocation();
5247 const mockAgentPath = yield* path.fromFileUrl(4974 const mockAgentPath = yield* path.fromFileUrl(
5248 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),4975 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5249 );4976 );
5250 const instanceId = ProviderInstanceId.make("acp-test");4977 const instanceId = ProviderInstanceId.make("acp-test");
5251 const promptSettled = yield* Deferred.make<void>();4978 const promptSettled = yield* Deferred.make<void>();
5252 const adapter = makeAcpAdapterV2({4979 const adapter = yield* makeAcpAdapterV2({
5253 testHooks: {4980 testHooks: {
5254 afterPromptSettledWithBackgroundWork: () =>4981 afterPromptSettledWithBackgroundWork: () =>
5255 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),4982 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
5256 },4983 },
5257 crypto: yield* Crypto.Crypto,
5258 instanceId,4984 instanceId,
5259 flavor: {4985 flavor: {
5260 driver: ACP_TEST_DRIVER,4986 driver: ACP_TEST_DRIVER,
...@@ -5278,9 +5004,6 @@ describe("AcpAdapterV2", () => {...@@ -5278,9 +5004,6 @@ describe("AcpAdapterV2", () => {
5278 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },5004 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
5279 }),5005 }),
5280 },5006 },
5281 fileSystem,
5282 idAllocator,
5283 host,
5284 selfInvocation,5007 selfInvocation,
5285 });5008 });
5286 const threadId = ThreadId.make("thread-acp-interrupt-background-hold");5009 const threadId = ThreadId.make("thread-acp-interrupt-background-hold");
...@@ -5335,10 +5058,8 @@ describe("AcpAdapterV2", () => {...@@ -5335,10 +5058,8 @@ describe("AcpAdapterV2", () => {
5335 () =>5058 () =>
5336 Effect.gen(function* () {5059 Effect.gen(function* () {
5337 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;5060 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5338 const fileSystem = yield* FileSystem.FileSystem;
5339 const idAllocator = yield* IdAllocator.IdAllocatorV2;5061 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5340 const path = yield* Path.Path;5062 const path = yield* Path.Path;
5341 const host = yield* ProviderHost.ProviderHost;
5342 const selfInvocation = yield* resolveSelfInvocation();5063 const selfInvocation = yield* resolveSelfInvocation();
5343 const mockAgentPath = yield* path.fromFileUrl(5064 const mockAgentPath = yield* path.fromFileUrl(
5344 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),5065 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -5346,12 +5067,11 @@ describe("AcpAdapterV2", () => {...@@ -5346,12 +5067,11 @@ describe("AcpAdapterV2", () => {
5346 const instanceId = ProviderInstanceId.make("acp-test");5067 const instanceId = ProviderInstanceId.make("acp-test");
5347 let subagentPhase: "spawn" | "complete" = "spawn";5068 let subagentPhase: "spawn" | "complete" = "spawn";
5348 const promptSettled = yield* Deferred.make<void>();5069 const promptSettled = yield* Deferred.make<void>();
5349 const adapter = makeAcpAdapterV2({5070 const adapter = yield* makeAcpAdapterV2({
5350 testHooks: {5071 testHooks: {
5351 afterPromptSettledWithBackgroundWork: () =>5072 afterPromptSettledWithBackgroundWork: () =>
5352 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),5073 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
5353 },5074 },
5354 crypto: yield* Crypto.Crypto,
5355 instanceId,5075 instanceId,
5356 flavor: {5076 flavor: {
5357 driver: ACP_TEST_DRIVER,5077 driver: ACP_TEST_DRIVER,
...@@ -5388,9 +5108,6 @@ describe("AcpAdapterV2", () => {...@@ -5388,9 +5108,6 @@ describe("AcpAdapterV2", () => {
5388 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },5108 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
5389 }),5109 }),
5390 },5110 },
5391 fileSystem,
5392 idAllocator,
5393 host,
5394 selfInvocation,5111 selfInvocation,
5395 });5112 });
5396 const threadId = ThreadId.make("thread-acp-subagent-carryover");5113 const threadId = ThreadId.make("thread-acp-subagent-carryover");
...@@ -5483,10 +5200,8 @@ describe("AcpAdapterV2", () => {...@@ -5483,10 +5200,8 @@ describe("AcpAdapterV2", () => {
5483 () =>5200 () =>
5484 Effect.gen(function* () {5201 Effect.gen(function* () {
5485 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;5202 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5486 const fileSystem = yield* FileSystem.FileSystem;
5487 const idAllocator = yield* IdAllocator.IdAllocatorV2;5203 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5488 const path = yield* Path.Path;5204 const path = yield* Path.Path;
5489 const host = yield* ProviderHost.ProviderHost;
5490 const selfInvocation = yield* resolveSelfInvocation();5205 const selfInvocation = yield* resolveSelfInvocation();
5491 const mockAgentPath = yield* path.fromFileUrl(5206 const mockAgentPath = yield* path.fromFileUrl(
5492 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),5207 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -5494,12 +5209,11 @@ describe("AcpAdapterV2", () => {...@@ -5494,12 +5209,11 @@ describe("AcpAdapterV2", () => {
5494 const instanceId = ProviderInstanceId.make("acp-test");5209 const instanceId = ProviderInstanceId.make("acp-test");
5495 let subagentPhase: "spawn" | "complete" = "spawn";5210 let subagentPhase: "spawn" | "complete" = "spawn";
5496 const promptSettled = yield* Deferred.make<void>();5211 const promptSettled = yield* Deferred.make<void>();
5497 const adapter = makeAcpAdapterV2({5212 const adapter = yield* makeAcpAdapterV2({
5498 testHooks: {5213 testHooks: {
5499 afterPromptSettledWithBackgroundWork: () =>5214 afterPromptSettledWithBackgroundWork: () =>
5500 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),5215 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
5501 },5216 },
5502 crypto: yield* Crypto.Crypto,
5503 instanceId,5217 instanceId,
5504 flavor: {5218 flavor: {
5505 driver: ACP_TEST_DRIVER,5219 driver: ACP_TEST_DRIVER,
...@@ -5534,9 +5248,6 @@ describe("AcpAdapterV2", () => {...@@ -5534,9 +5248,6 @@ describe("AcpAdapterV2", () => {
5534 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },5248 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
5535 }),5249 }),
5536 },5250 },
5537 fileSystem,
5538 idAllocator,
5539 host,
5540 selfInvocation,5251 selfInvocation,
5541 continuationRequests: { offer: () => Effect.void },5252 continuationRequests: { offer: () => Effect.void },
5542 });5253 });
...@@ -5630,10 +5341,8 @@ describe("AcpAdapterV2", () => {...@@ -5630,10 +5341,8 @@ describe("AcpAdapterV2", () => {
5630 it.effect("handles a child terminal after carryover rehydrate", () =>5341 it.effect("handles a child terminal after carryover rehydrate", () =>
5631 Effect.gen(function* () {5342 Effect.gen(function* () {
5632 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;5343 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5633 const fileSystem = yield* FileSystem.FileSystem;
5634 const idAllocator = yield* IdAllocator.IdAllocatorV2;5344 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5635 const path = yield* Path.Path;5345 const path = yield* Path.Path;
5636 const host = yield* ProviderHost.ProviderHost;
5637 const selfInvocation = yield* resolveSelfInvocation();5346 const selfInvocation = yield* resolveSelfInvocation();
5638 const mockAgentPath = yield* path.fromFileUrl(5347 const mockAgentPath = yield* path.fromFileUrl(
5639 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),5348 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -5647,12 +5356,11 @@ describe("AcpAdapterV2", () => {...@@ -5647,12 +5356,11 @@ describe("AcpAdapterV2", () => {
5647 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];5356 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
5648 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;5357 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
5649 const promptSettled = yield* Deferred.make<void>();5358 const promptSettled = yield* Deferred.make<void>();
5650 const adapter = makeAcpAdapterV2({5359 const adapter = yield* makeAcpAdapterV2({
5651 testHooks: {5360 testHooks: {
5652 afterPromptSettledWithBackgroundWork: () =>5361 afterPromptSettledWithBackgroundWork: () =>
5653 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),5362 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
5654 },5363 },
5655 crypto: yield* Crypto.Crypto,
5656 instanceId,5364 instanceId,
5657 flavor: {5365 flavor: {
5658 driver: ACP_TEST_DRIVER,5366 driver: ACP_TEST_DRIVER,
...@@ -5704,9 +5412,6 @@ describe("AcpAdapterV2", () => {...@@ -5704,9 +5412,6 @@ describe("AcpAdapterV2", () => {
5704 }),5412 }),
5705 }),5413 }),
5706 },5414 },
5707 fileSystem,
5708 idAllocator,
5709 host,
5710 selfInvocation,5415 selfInvocation,
5711 continuationRequests: { offer: () => Effect.void },5416 continuationRequests: { offer: () => Effect.void },
5712 });5417 });
...@@ -5867,10 +5572,8 @@ describe("AcpAdapterV2", () => {...@@ -5867,10 +5572,8 @@ describe("AcpAdapterV2", () => {
5867 () =>5572 () =>
5868 Effect.gen(function* () {5573 Effect.gen(function* () {
5869 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;5574 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5870 const fileSystem = yield* FileSystem.FileSystem;
5871 const idAllocator = yield* IdAllocator.IdAllocatorV2;5575 const idAllocator = yield* IdAllocator.IdAllocatorV2;
5872 const path = yield* Path.Path;5576 const path = yield* Path.Path;
5873 const host = yield* ProviderHost.ProviderHost;
5874 const selfInvocation = yield* resolveSelfInvocation();5577 const selfInvocation = yield* resolveSelfInvocation();
5875 const mockAgentPath = yield* path.fromFileUrl(5578 const mockAgentPath = yield* path.fromFileUrl(
5876 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),5579 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -5903,12 +5606,11 @@ describe("AcpAdapterV2", () => {...@@ -5903,12 +5606,11 @@ describe("AcpAdapterV2", () => {
5903 | Parameters<RuntimeService["handleSessionUpdate"]>[0]5606 | Parameters<RuntimeService["handleSessionUpdate"]>[0]
5904 | undefined;5607 | undefined;
5905 const promptSettled = yield* Deferred.make<void>();5608 const promptSettled = yield* Deferred.make<void>();
5906 const adapter = makeAcpAdapterV2({5609 const adapter = yield* makeAcpAdapterV2({
5907 testHooks: {5610 testHooks: {
5908 afterPromptSettledWithBackgroundWork: () =>5611 afterPromptSettledWithBackgroundWork: () =>
5909 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),5612 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
5910 },5613 },
5911 crypto: yield* Crypto.Crypto,
5912 instanceId,5614 instanceId,
5913 flavor: {5615 flavor: {
5914 driver: ACP_TEST_DRIVER,5616 driver: ACP_TEST_DRIVER,
...@@ -5955,9 +5657,6 @@ describe("AcpAdapterV2", () => {...@@ -5955,9 +5657,6 @@ describe("AcpAdapterV2", () => {
5955 }),5657 }),
5956 }),5658 }),
5957 },5659 },
5958 fileSystem,
5959 idAllocator,
5960 host,
5961 selfInvocation,5660 selfInvocation,
5962 continuationRequests: { offer: () => Effect.void },5661 continuationRequests: { offer: () => Effect.void },
5963 });5662 });
...@@ -6090,10 +5789,8 @@ describe("AcpAdapterV2", () => {...@@ -6090,10 +5789,8 @@ describe("AcpAdapterV2", () => {
6090 () =>5789 () =>
6091 Effect.gen(function* () {5790 Effect.gen(function* () {
6092 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;5791 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6093 const fileSystem = yield* FileSystem.FileSystem;
6094 const idAllocator = yield* IdAllocator.IdAllocatorV2;5792 const idAllocator = yield* IdAllocator.IdAllocatorV2;
6095 const path = yield* Path.Path;5793 const path = yield* Path.Path;
6096 const host = yield* ProviderHost.ProviderHost;
6097 const selfInvocation = yield* resolveSelfInvocation();5794 const selfInvocation = yield* resolveSelfInvocation();
6098 const mockAgentPath = yield* path.fromFileUrl(5795 const mockAgentPath = yield* path.fromFileUrl(
6099 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),5796 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -6106,12 +5803,11 @@ describe("AcpAdapterV2", () => {...@@ -6106,12 +5803,11 @@ describe("AcpAdapterV2", () => {
6106 let subagentPhase: "spawn" | "complete" = "spawn";5803 let subagentPhase: "spawn" | "complete" = "spawn";
6107 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];5804 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
6108 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;5805 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
6109 const adapter = makeAcpAdapterV2({5806 const adapter = yield* makeAcpAdapterV2({
6110 testHooks: {5807 testHooks: {
6111 afterPromptSettledWithBackgroundWork: () =>5808 afterPromptSettledWithBackgroundWork: () =>
6112 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),5809 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
6113 },5810 },
6114 crypto: yield* Crypto.Crypto,
6115 instanceId,5811 instanceId,
6116 flavor: {5812 flavor: {
6117 driver: ACP_TEST_DRIVER,5813 driver: ACP_TEST_DRIVER,
...@@ -6154,9 +5850,6 @@ describe("AcpAdapterV2", () => {...@@ -6154,9 +5850,6 @@ describe("AcpAdapterV2", () => {
6154 }),5850 }),
6155 }),5851 }),
6156 },5852 },
6157 fileSystem,
6158 idAllocator,
6159 host,
6160 selfInvocation,5853 selfInvocation,
6161 continuationRequests: {5854 continuationRequests: {
6162 offer: (request) =>5855 offer: (request) =>
...@@ -6309,10 +6002,8 @@ describe("AcpAdapterV2", () => {...@@ -6309,10 +6002,8 @@ describe("AcpAdapterV2", () => {
6309 it.effect("finishes a settled root's carryover subagent from its structured end", () =>6002 it.effect("finishes a settled root's carryover subagent from its structured end", () =>
6310 Effect.gen(function* () {6003 Effect.gen(function* () {
6311 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;6004 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6312 const fileSystem = yield* FileSystem.FileSystem;
6313 const idAllocator = yield* IdAllocator.IdAllocatorV2;6005 const idAllocator = yield* IdAllocator.IdAllocatorV2;
6314 const path = yield* Path.Path;6006 const path = yield* Path.Path;
6315 const host = yield* ProviderHost.ProviderHost;
6316 const selfInvocation = yield* resolveSelfInvocation();6007 const selfInvocation = yield* resolveSelfInvocation();
6317 const mockAgentPath = yield* path.fromFileUrl(6008 const mockAgentPath = yield* path.fromFileUrl(
6318 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),6009 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -6321,8 +6012,7 @@ describe("AcpAdapterV2", () => {...@@ -6321,8 +6012,7 @@ describe("AcpAdapterV2", () => {
6321 const instanceId = ProviderInstanceId.make("acp-test");6012 const instanceId = ProviderInstanceId.make("acp-test");
6322 const childSessionId = "019f44a6-4820-7402-925d-bc862ee711dd";6013 const childSessionId = "019f44a6-4820-7402-925d-bc862ee711dd";
6323 let finishSubagent: AcpAdapterV2ExtensionContext["finishSubagent"] | undefined;6014 let finishSubagent: AcpAdapterV2ExtensionContext["finishSubagent"] | undefined;
6324 const adapter = makeAcpAdapterV2({6015 const adapter = yield* makeAcpAdapterV2({
6325 crypto: yield* Crypto.Crypto,
6326 instanceId,6016 instanceId,
6327 flavor: {6017 flavor: {
6328 driver: ACP_TEST_DRIVER,6018 driver: ACP_TEST_DRIVER,
...@@ -6352,9 +6042,6 @@ describe("AcpAdapterV2", () => {...@@ -6352,9 +6042,6 @@ describe("AcpAdapterV2", () => {
6352 protocolEvents,6042 protocolEvents,
6353 }),6043 }),
6354 },6044 },
6355 fileSystem,
6356 idAllocator,
6357 host,
6358 selfInvocation,6045 selfInvocation,
6359 continuationRequests: { offer: () => Effect.void },6046 continuationRequests: { offer: () => Effect.void },
6360 });6047 });
...@@ -6457,10 +6144,8 @@ describe("AcpAdapterV2", () => {...@@ -6457,10 +6144,8 @@ describe("AcpAdapterV2", () => {
6457 it.effect("projects completed-root carryover eagerly and drain cannot resurrect it", () =>6144 it.effect("projects completed-root carryover eagerly and drain cannot resurrect it", () =>
6458 Effect.gen(function* () {6145 Effect.gen(function* () {
6459 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;6146 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6460 const fileSystem = yield* FileSystem.FileSystem;
6461 const idAllocator = yield* IdAllocator.IdAllocatorV2;6147 const idAllocator = yield* IdAllocator.IdAllocatorV2;
6462 const path = yield* Path.Path;6148 const path = yield* Path.Path;
6463 const host = yield* ProviderHost.ProviderHost;
6464 const selfInvocation = yield* resolveSelfInvocation();6149 const selfInvocation = yield* resolveSelfInvocation();
6465 const mockAgentPath = yield* path.fromFileUrl(6150 const mockAgentPath = yield* path.fromFileUrl(
6466 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),6151 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -6472,8 +6157,7 @@ describe("AcpAdapterV2", () => {...@@ -6472,8 +6157,7 @@ describe("AcpAdapterV2", () => {
6472 let subagentPhase: "spawn" | "complete" = "spawn";6157 let subagentPhase: "spawn" | "complete" = "spawn";
6473 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];6158 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
6474 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;6159 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
6475 const adapter = makeAcpAdapterV2({6160 const adapter = yield* makeAcpAdapterV2({
6476 crypto: yield* Crypto.Crypto,
6477 instanceId,6161 instanceId,
6478 flavor: {6162 flavor: {
6479 driver: ACP_TEST_DRIVER,6163 driver: ACP_TEST_DRIVER,
...@@ -6517,9 +6201,6 @@ describe("AcpAdapterV2", () => {...@@ -6517,9 +6201,6 @@ describe("AcpAdapterV2", () => {
6517 }),6201 }),
6518 }),6202 }),
6519 },6203 },
6520 fileSystem,
6521 idAllocator,
6522 host,
6523 selfInvocation,6204 selfInvocation,
6524 continuationRequests: {6205 continuationRequests: {
6525 offer: (request) =>6206 offer: (request) =>
...@@ -6709,10 +6390,8 @@ describe("AcpAdapterV2", () => {...@@ -6709,10 +6390,8 @@ describe("AcpAdapterV2", () => {
6709 () =>6390 () =>
6710 Effect.gen(function* () {6391 Effect.gen(function* () {
6711 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;6392 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6712 const fileSystem = yield* FileSystem.FileSystem;
6713 const idAllocator = yield* IdAllocator.IdAllocatorV2;6393 const idAllocator = yield* IdAllocator.IdAllocatorV2;
6714 const path = yield* Path.Path;6394 const path = yield* Path.Path;
6715 const host = yield* ProviderHost.ProviderHost;
6716 const selfInvocation = yield* resolveSelfInvocation();6395 const selfInvocation = yield* resolveSelfInvocation();
6717 const mockAgentPath = yield* path.fromFileUrl(6396 const mockAgentPath = yield* path.fromFileUrl(
6718 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),6397 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -6724,12 +6403,11 @@ describe("AcpAdapterV2", () => {...@@ -6724,12 +6403,11 @@ describe("AcpAdapterV2", () => {
6724 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];6403 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
6725 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;6404 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
6726 const promptSettled = yield* Deferred.make<void>();6405 const promptSettled = yield* Deferred.make<void>();
6727 const adapter = makeAcpAdapterV2({6406 const adapter = yield* makeAcpAdapterV2({
6728 testHooks: {6407 testHooks: {
6729 afterPromptSettledWithBackgroundWork: () =>6408 afterPromptSettledWithBackgroundWork: () =>
6730 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),6409 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
6731 },6410 },
6732 crypto: yield* Crypto.Crypto,
6733 instanceId,6411 instanceId,
6734 flavor: {6412 flavor: {
6735 driver: ACP_TEST_DRIVER,6413 driver: ACP_TEST_DRIVER,
...@@ -6771,9 +6449,6 @@ describe("AcpAdapterV2", () => {...@@ -6771,9 +6449,6 @@ describe("AcpAdapterV2", () => {
6771 }),6449 }),
6772 }),6450 }),
6773 },6451 },
6774 fileSystem,
6775 idAllocator,
6776 host,
6777 selfInvocation,6452 selfInvocation,
6778 continuationRequests: {6453 continuationRequests: {
6779 offer: (request) =>6454 offer: (request) =>
...@@ -6997,10 +6672,8 @@ describe("AcpAdapterV2", () => {...@@ -6997,10 +6672,8 @@ describe("AcpAdapterV2", () => {
6997 () =>6672 () =>
6998 Effect.gen(function* () {6673 Effect.gen(function* () {
6999 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;6674 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7000 const fileSystem = yield* FileSystem.FileSystem;
7001 const idAllocator = yield* IdAllocator.IdAllocatorV2;6675 const idAllocator = yield* IdAllocator.IdAllocatorV2;
7002 const path = yield* Path.Path;6676 const path = yield* Path.Path;
7003 const host = yield* ProviderHost.ProviderHost;
7004 const selfInvocation = yield* resolveSelfInvocation();6677 const selfInvocation = yield* resolveSelfInvocation();
7005 const mockAgentPath = yield* path.fromFileUrl(6678 const mockAgentPath = yield* path.fromFileUrl(
7006 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),6679 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -7013,12 +6686,11 @@ describe("AcpAdapterV2", () => {...@@ -7013,12 +6686,11 @@ describe("AcpAdapterV2", () => {
7013 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];6686 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
7014 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;6687 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
7015 const promptSettled = yield* Deferred.make<void>();6688 const promptSettled = yield* Deferred.make<void>();
7016 const adapter = makeAcpAdapterV2({6689 const adapter = yield* makeAcpAdapterV2({
7017 testHooks: {6690 testHooks: {
7018 afterPromptSettledWithBackgroundWork: () =>6691 afterPromptSettledWithBackgroundWork: () =>
7019 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),6692 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
7020 },6693 },
7021 crypto: yield* Crypto.Crypto,
7022 instanceId,6694 instanceId,
7023 flavor: {6695 flavor: {
7024 driver: ACP_TEST_DRIVER,6696 driver: ACP_TEST_DRIVER,
...@@ -7069,9 +6741,6 @@ describe("AcpAdapterV2", () => {...@@ -7069,9 +6741,6 @@ describe("AcpAdapterV2", () => {
7069 }),6741 }),
7070 }),6742 }),
7071 },6743 },
7072 fileSystem,
7073 idAllocator,
7074 host,
7075 selfInvocation,6744 selfInvocation,
7076 continuationRequests: {6745 continuationRequests: {
7077 offer: (request) =>6746 offer: (request) =>
...@@ -7238,10 +6907,8 @@ describe("AcpAdapterV2", () => {...@@ -7238,10 +6907,8 @@ describe("AcpAdapterV2", () => {
7238 it.effect("projects an interrupted root-session end notice at the next attach", () =>6907 it.effect("projects an interrupted root-session end notice at the next attach", () =>
7239 Effect.gen(function* () {6908 Effect.gen(function* () {
7240 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;6909 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7241 const fileSystem = yield* FileSystem.FileSystem;
7242 const idAllocator = yield* IdAllocator.IdAllocatorV2;6910 const idAllocator = yield* IdAllocator.IdAllocatorV2;
7243 const path = yield* Path.Path;6911 const path = yield* Path.Path;
7244 const host = yield* ProviderHost.ProviderHost;
7245 const selfInvocation = yield* resolveSelfInvocation();6912 const selfInvocation = yield* resolveSelfInvocation();
7246 const mockAgentPath = yield* path.fromFileUrl(6913 const mockAgentPath = yield* path.fromFileUrl(
7247 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),6914 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -7254,12 +6921,11 @@ describe("AcpAdapterV2", () => {...@@ -7254,12 +6921,11 @@ describe("AcpAdapterV2", () => {
7254 let subagentPhase: "spawn" | "complete" = "spawn";6921 let subagentPhase: "spawn" | "complete" = "spawn";
7255 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];6922 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
7256 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;6923 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
7257 const adapter = makeAcpAdapterV2({6924 const adapter = yield* makeAcpAdapterV2({
7258 testHooks: {6925 testHooks: {
7259 afterPromptSettledWithBackgroundWork: () =>6926 afterPromptSettledWithBackgroundWork: () =>
7260 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),6927 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
7261 },6928 },
7262 crypto: yield* Crypto.Crypto,
7263 instanceId,6929 instanceId,
7264 flavor: {6930 flavor: {
7265 driver: ACP_TEST_DRIVER,6931 driver: ACP_TEST_DRIVER,
...@@ -7313,9 +6979,6 @@ describe("AcpAdapterV2", () => {...@@ -7313,9 +6979,6 @@ describe("AcpAdapterV2", () => {
7313 }),6979 }),
7314 }),6980 }),
7315 },6981 },
7316 fileSystem,
7317 idAllocator,
7318 host,
7319 selfInvocation,6982 selfInvocation,
7320 continuationRequests: {6983 continuationRequests: {
7321 offer: (request) =>6984 offer: (request) =>
...@@ -7467,10 +7130,8 @@ describe("AcpAdapterV2", () => {...@@ -7467,10 +7130,8 @@ describe("AcpAdapterV2", () => {
7467 () =>7130 () =>
7468 Effect.gen(function* () {7131 Effect.gen(function* () {
7469 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;7132 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7470 const fileSystem = yield* FileSystem.FileSystem;
7471 const idAllocator = yield* IdAllocator.IdAllocatorV2;7133 const idAllocator = yield* IdAllocator.IdAllocatorV2;
7472 const path = yield* Path.Path;7134 const path = yield* Path.Path;
7473 const host = yield* ProviderHost.ProviderHost;
7474 const selfInvocation = yield* resolveSelfInvocation();7135 const selfInvocation = yield* resolveSelfInvocation();
7475 const mockAgentPath = yield* path.fromFileUrl(7136 const mockAgentPath = yield* path.fromFileUrl(
7476 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),7137 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -7483,12 +7144,11 @@ describe("AcpAdapterV2", () => {...@@ -7483,12 +7144,11 @@ describe("AcpAdapterV2", () => {
7483 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];7144 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
7484 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;7145 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
7485 const promptSettled = yield* Deferred.make<void>();7146 const promptSettled = yield* Deferred.make<void>();
7486 const adapter = makeAcpAdapterV2({7147 const adapter = yield* makeAcpAdapterV2({
7487 testHooks: {7148 testHooks: {
7488 afterPromptSettledWithBackgroundWork: () =>7149 afterPromptSettledWithBackgroundWork: () =>
7489 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),7150 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
7490 },7151 },
7491 crypto: yield* Crypto.Crypto,
7492 instanceId,7152 instanceId,
7493 flavor: {7153 flavor: {
7494 driver: ACP_TEST_DRIVER,7154 driver: ACP_TEST_DRIVER,
...@@ -7530,9 +7190,6 @@ describe("AcpAdapterV2", () => {...@@ -7530,9 +7190,6 @@ describe("AcpAdapterV2", () => {
7530 }),7190 }),
7531 }),7191 }),
7532 },7192 },
7533 fileSystem,
7534 idAllocator,
7535 host,
7536 selfInvocation,7193 selfInvocation,
7537 continuationRequests: {7194 continuationRequests: {
7538 offer: (request) =>7195 offer: (request) =>
...@@ -7738,10 +7395,8 @@ describe("AcpAdapterV2", () => {...@@ -7738,10 +7395,8 @@ describe("AcpAdapterV2", () => {
7738 () =>7395 () =>
7739 Effect.gen(function* () {7396 Effect.gen(function* () {
7740 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;7397 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7741 const fileSystem = yield* FileSystem.FileSystem;
7742 const idAllocator = yield* IdAllocator.IdAllocatorV2;7398 const idAllocator = yield* IdAllocator.IdAllocatorV2;
7743 const path = yield* Path.Path;7399 const path = yield* Path.Path;
7744 const host = yield* ProviderHost.ProviderHost;
7745 const selfInvocation = yield* resolveSelfInvocation();7400 const selfInvocation = yield* resolveSelfInvocation();
7746 const mockAgentPath = yield* path.fromFileUrl(7401 const mockAgentPath = yield* path.fromFileUrl(
7747 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),7402 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -7753,12 +7408,11 @@ describe("AcpAdapterV2", () => {...@@ -7753,12 +7408,11 @@ describe("AcpAdapterV2", () => {
7753 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];7408 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
7754 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;7409 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
7755 const promptSettled = yield* Deferred.make<void>();7410 const promptSettled = yield* Deferred.make<void>();
7756 const adapter = makeAcpAdapterV2({7411 const adapter = yield* makeAcpAdapterV2({
7757 testHooks: {7412 testHooks: {
7758 afterPromptSettledWithBackgroundWork: () =>7413 afterPromptSettledWithBackgroundWork: () =>
7759 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),7414 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
7760 },7415 },
7761 crypto: yield* Crypto.Crypto,
7762 instanceId,7416 instanceId,
7763 flavor: {7417 flavor: {
7764 driver: ACP_TEST_DRIVER,7418 driver: ACP_TEST_DRIVER,
...@@ -7800,9 +7454,6 @@ describe("AcpAdapterV2", () => {...@@ -7800,9 +7454,6 @@ describe("AcpAdapterV2", () => {
7800 }),7454 }),
7801 }),7455 }),
7802 },7456 },
7803 fileSystem,
7804 idAllocator,
7805 host,
7806 selfInvocation,7457 selfInvocation,
7807 continuationRequests: {7458 continuationRequests: {
7808 offer: (request) =>7459 offer: (request) =>
...@@ -7980,10 +7631,8 @@ describe("AcpAdapterV2", () => {...@@ -7980,10 +7631,8 @@ describe("AcpAdapterV2", () => {
7980 () =>7631 () =>
7981 Effect.gen(function* () {7632 Effect.gen(function* () {
7982 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;7633 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7983 const fileSystem = yield* FileSystem.FileSystem;
7984 const idAllocator = yield* IdAllocator.IdAllocatorV2;7634 const idAllocator = yield* IdAllocator.IdAllocatorV2;
7985 const path = yield* Path.Path;7635 const path = yield* Path.Path;
7986 const host = yield* ProviderHost.ProviderHost;
7987 const selfInvocation = yield* resolveSelfInvocation();7636 const selfInvocation = yield* resolveSelfInvocation();
7988 const mockAgentPath = yield* path.fromFileUrl(7637 const mockAgentPath = yield* path.fromFileUrl(
7989 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),7638 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -7993,12 +7642,11 @@ describe("AcpAdapterV2", () => {...@@ -7993,12 +7642,11 @@ describe("AcpAdapterV2", () => {
7993 let cancelCalled = false;7642 let cancelCalled = false;
7994 let runtimeOrdinalSeen = 0;7643 let runtimeOrdinalSeen = 0;
7995 const promptSettled = yield* Deferred.make<void>();7644 const promptSettled = yield* Deferred.make<void>();
7996 const adapter = makeAcpAdapterV2({7645 const adapter = yield* makeAcpAdapterV2({
7997 testHooks: {7646 testHooks: {
7998 afterPromptSettledWithBackgroundWork: () =>7647 afterPromptSettledWithBackgroundWork: () =>
7999 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),7648 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
8000 },7649 },
8001 crypto: yield* Crypto.Crypto,
8002 instanceId,7650 instanceId,
8003 flavor: {7651 flavor: {
8004 driver: ACP_TEST_DRIVER,7652 driver: ACP_TEST_DRIVER,
...@@ -8050,9 +7698,6 @@ describe("AcpAdapterV2", () => {...@@ -8050,9 +7698,6 @@ describe("AcpAdapterV2", () => {
8050 }).pipe(Effect.andThen(cancel)),7698 }).pipe(Effect.andThen(cancel)),
8051 }),7699 }),
8052 },7700 },
8053 fileSystem,
8054 idAllocator,
8055 host,
8056 selfInvocation,7701 selfInvocation,
8057 });7702 });
8058 const threadId = ThreadId.make("thread-acp-settled-soft-steer");7703 const threadId = ThreadId.make("thread-acp-settled-soft-steer");
...@@ -8156,18 +7801,15 @@ describe("AcpAdapterV2", () => {...@@ -8156,18 +7801,15 @@ describe("AcpAdapterV2", () => {
8156 it.live("preserveRuntimeOnSettledInterrupt does not soften a mid-prompt steering interrupt", () =>7801 it.live("preserveRuntimeOnSettledInterrupt does not soften a mid-prompt steering interrupt", () =>
8157 Effect.gen(function* () {7802 Effect.gen(function* () {
8158 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;7803 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8159 const fileSystem = yield* FileSystem.FileSystem;
8160 const idAllocator = yield* IdAllocator.IdAllocatorV2;7804 const idAllocator = yield* IdAllocator.IdAllocatorV2;
8161 const path = yield* Path.Path;7805 const path = yield* Path.Path;
8162 const host = yield* ProviderHost.ProviderHost;
8163 const selfInvocation = yield* resolveSelfInvocation();7806 const selfInvocation = yield* resolveSelfInvocation();
8164 const mockAgentPath = yield* path.fromFileUrl(7807 const mockAgentPath = yield* path.fromFileUrl(
8165 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),7808 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8166 );7809 );
8167 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);7810 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
8168 const instanceId = ProviderInstanceId.make("acp-test");7811 const instanceId = ProviderInstanceId.make("acp-test");
8169 const adapter = makeAcpAdapterV2({7812 const adapter = yield* makeAcpAdapterV2({
8170 crypto: yield* Crypto.Crypto,
8171 instanceId,7813 instanceId,
8172 flavor: {7814 flavor: {
8173 driver: ACP_TEST_DRIVER,7815 driver: ACP_TEST_DRIVER,
...@@ -8189,9 +7831,6 @@ describe("AcpAdapterV2", () => {...@@ -8189,9 +7831,6 @@ describe("AcpAdapterV2", () => {
8189 protocolEvents,7831 protocolEvents,
8190 }),7832 }),
8191 },7833 },
8192 fileSystem,
8193 idAllocator,
8194 host,
8195 selfInvocation,7834 selfInvocation,
8196 });7835 });
8197 const threadId = ThreadId.make("thread-acp-unsettled-steer-stays-hard");7836 const threadId = ThreadId.make("thread-acp-unsettled-steer-stays-hard");
...@@ -8246,10 +7885,8 @@ describe("AcpAdapterV2", () => {...@@ -8246,10 +7885,8 @@ describe("AcpAdapterV2", () => {
8246 () =>7885 () =>
8247 Effect.gen(function* () {7886 Effect.gen(function* () {
8248 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;7887 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8249 const fileSystem = yield* FileSystem.FileSystem;
8250 const idAllocator = yield* IdAllocator.IdAllocatorV2;7888 const idAllocator = yield* IdAllocator.IdAllocatorV2;
8251 const path = yield* Path.Path;7889 const path = yield* Path.Path;
8252 const host = yield* ProviderHost.ProviderHost;
8253 const selfInvocation = yield* resolveSelfInvocation();7890 const selfInvocation = yield* resolveSelfInvocation();
8254 const mockAgentPath = yield* path.fromFileUrl(7891 const mockAgentPath = yield* path.fromFileUrl(
8255 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),7892 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -8259,8 +7896,7 @@ describe("AcpAdapterV2", () => {...@@ -8259,8 +7896,7 @@ describe("AcpAdapterV2", () => {
8259 const instanceId = ProviderInstanceId.make("acp-test");7896 const instanceId = ProviderInstanceId.make("acp-test");
8260 let cancelCalled = false;7897 let cancelCalled = false;
8261 let runtimeOrdinalSeen = 0;7898 let runtimeOrdinalSeen = 0;
8262 const adapter = makeAcpAdapterV2({7899 const adapter = yield* makeAcpAdapterV2({
8263 crypto: yield* Crypto.Crypto,
8264 instanceId,7900 instanceId,
8265 flavor: {7901 flavor: {
8266 driver: ACP_TEST_DRIVER,7902 driver: ACP_TEST_DRIVER,
...@@ -8295,9 +7931,6 @@ describe("AcpAdapterV2", () => {...@@ -8295,9 +7931,6 @@ describe("AcpAdapterV2", () => {
8295 }).pipe(Effect.andThen(cancel)),7931 }).pipe(Effect.andThen(cancel)),
8296 }),7932 }),
8297 },7933 },
8298 fileSystem,
8299 idAllocator,
8300 host,
8301 selfInvocation,7934 selfInvocation,
8302 continuationRequests: {7935 continuationRequests: {
8303 offer: (request) =>7936 offer: (request) =>
...@@ -8440,10 +8073,8 @@ describe("AcpAdapterV2", () => {...@@ -8440,10 +8073,8 @@ describe("AcpAdapterV2", () => {
8440 it.live("direct Stop quarantine drops late background task mutations from the stopped run", () =>8073 it.live("direct Stop quarantine drops late background task mutations from the stopped run", () =>
8441 Effect.gen(function* () {8074 Effect.gen(function* () {
8442 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8075 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8443 const fileSystem = yield* FileSystem.FileSystem;
8444 const idAllocator = yield* IdAllocator.IdAllocatorV2;8076 const idAllocator = yield* IdAllocator.IdAllocatorV2;
8445 const path = yield* Path.Path;8077 const path = yield* Path.Path;
8446 const host = yield* ProviderHost.ProviderHost;
8447 const selfInvocation = yield* resolveSelfInvocation();8078 const selfInvocation = yield* resolveSelfInvocation();
8448 const mockAgentPath = yield* path.fromFileUrl(8079 const mockAgentPath = yield* path.fromFileUrl(
8449 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8080 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -8459,8 +8090,7 @@ describe("AcpAdapterV2", () => {...@@ -8459,8 +8090,7 @@ describe("AcpAdapterV2", () => {
8459 }) => Effect.Effect<void>)8090 }) => Effect.Effect<void>)
8460 | null;8091 | null;
8461 } = { current: null };8092 } = { current: null };
8462 const adapter = makeAcpAdapterV2({8093 const adapter = yield* makeAcpAdapterV2({
8463 crypto: yield* Crypto.Crypto,
8464 instanceId,8094 instanceId,
8465 flavor: {8095 flavor: {
8466 driver: ACP_TEST_DRIVER,8096 driver: ACP_TEST_DRIVER,
...@@ -8481,9 +8111,6 @@ describe("AcpAdapterV2", () => {...@@ -8481,9 +8111,6 @@ describe("AcpAdapterV2", () => {
8481 protocolEvents,8111 protocolEvents,
8482 }),8112 }),
8483 },8113 },
8484 fileSystem,
8485 idAllocator,
8486 host,
8487 selfInvocation,8114 selfInvocation,
8488 continuationRequests: { offer: () => Effect.void },8115 continuationRequests: { offer: () => Effect.void },
8489 });8116 });
...@@ -8587,10 +8214,8 @@ describe("AcpAdapterV2", () => {...@@ -8587,10 +8214,8 @@ describe("AcpAdapterV2", () => {
8587 it.live("production Grok interrupt flags still hard-kill and respawn on user Stop", () =>8214 it.live("production Grok interrupt flags still hard-kill and respawn on user Stop", () =>
8588 Effect.gen(function* () {8215 Effect.gen(function* () {
8589 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8216 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8590 const fileSystem = yield* FileSystem.FileSystem;
8591 const idAllocator = yield* IdAllocator.IdAllocatorV2;8217 const idAllocator = yield* IdAllocator.IdAllocatorV2;
8592 const path = yield* Path.Path;8218 const path = yield* Path.Path;
8593 const host = yield* ProviderHost.ProviderHost;
8594 const selfInvocation = yield* resolveSelfInvocation();8219 const selfInvocation = yield* resolveSelfInvocation();
8595 const mockAgentPath = yield* path.fromFileUrl(8220 const mockAgentPath = yield* path.fromFileUrl(
8596 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8221 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -8598,8 +8223,7 @@ describe("AcpAdapterV2", () => {...@@ -8598,8 +8223,7 @@ describe("AcpAdapterV2", () => {
8598 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);8223 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
8599 const instanceId = ProviderInstanceId.make("acp-test");8224 const instanceId = ProviderInstanceId.make("acp-test");
8600 let runtimeOrdinalSeen = 0;8225 let runtimeOrdinalSeen = 0;
8601 const adapter = makeAcpAdapterV2({8226 const adapter = yield* makeAcpAdapterV2({
8602 crypto: yield* Crypto.Crypto,
8603 instanceId,8227 instanceId,
8604 flavor: {8228 flavor: {
8605 driver: ACP_TEST_DRIVER,8229 driver: ACP_TEST_DRIVER,
...@@ -8627,9 +8251,6 @@ describe("AcpAdapterV2", () => {...@@ -8627,9 +8251,6 @@ describe("AcpAdapterV2", () => {
8627 protocolEvents,8251 protocolEvents,
8628 }),8252 }),
8629 },8253 },
8630 fileSystem,
8631 idAllocator,
8632 host,
8633 selfInvocation,8254 selfInvocation,
8634 continuationRequests: { offer: () => Effect.void },8255 continuationRequests: { offer: () => Effect.void },
8635 });8256 });
...@@ -8718,10 +8339,8 @@ describe("AcpAdapterV2", () => {...@@ -8718,10 +8339,8 @@ describe("AcpAdapterV2", () => {
8718 () =>8339 () =>
8719 Effect.gen(function* () {8340 Effect.gen(function* () {
8720 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8341 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8721 const fileSystem = yield* FileSystem.FileSystem;
8722 const idAllocator = yield* IdAllocator.IdAllocatorV2;8342 const idAllocator = yield* IdAllocator.IdAllocatorV2;
8723 const path = yield* Path.Path;8343 const path = yield* Path.Path;
8724 const host = yield* ProviderHost.ProviderHost;
8725 const selfInvocation = yield* resolveSelfInvocation();8344 const selfInvocation = yield* resolveSelfInvocation();
8726 const mockAgentPath = yield* path.fromFileUrl(8345 const mockAgentPath = yield* path.fromFileUrl(
8727 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8346 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -8736,12 +8355,11 @@ describe("AcpAdapterV2", () => {...@@ -8736,12 +8355,11 @@ describe("AcpAdapterV2", () => {
8736 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];8355 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
8737 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;8356 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
8738 const promptSettled = yield* Deferred.make<void>();8357 const promptSettled = yield* Deferred.make<void>();
8739 const adapter = makeAcpAdapterV2({8358 const adapter = yield* makeAcpAdapterV2({
8740 testHooks: {8359 testHooks: {
8741 afterPromptSettledWithBackgroundWork: () =>8360 afterPromptSettledWithBackgroundWork: () =>
8742 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),8361 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
8743 },8362 },
8744 crypto: yield* Crypto.Crypto,
8745 instanceId,8363 instanceId,
8746 flavor: {8364 flavor: {
8747 driver: ACP_TEST_DRIVER,8365 driver: ACP_TEST_DRIVER,
...@@ -8796,9 +8414,6 @@ describe("AcpAdapterV2", () => {...@@ -8796,9 +8414,6 @@ describe("AcpAdapterV2", () => {
8796 }),8414 }),
8797 }),8415 }),
8798 },8416 },
8799 fileSystem,
8800 idAllocator,
8801 host,
8802 selfInvocation,8417 selfInvocation,
8803 });8418 });
8804 const threadId = ThreadId.make("thread-acp-stop-after-soft-steer-orphan");8419 const threadId = ThreadId.make("thread-acp-stop-after-soft-steer-orphan");
...@@ -9022,10 +8637,8 @@ describe("AcpAdapterV2", () => {...@@ -9022,10 +8637,8 @@ describe("AcpAdapterV2", () => {
9022 it.live("Direct Stop projects an interrupt-deferred terminal exactly once", () =>8637 it.live("Direct Stop projects an interrupt-deferred terminal exactly once", () =>
9023 Effect.gen(function* () {8638 Effect.gen(function* () {
9024 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8639 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9025 const fileSystem = yield* FileSystem.FileSystem;
9026 const idAllocator = yield* IdAllocator.IdAllocatorV2;8640 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9027 const path = yield* Path.Path;8641 const path = yield* Path.Path;
9028 const host = yield* ProviderHost.ProviderHost;
9029 const selfInvocation = yield* resolveSelfInvocation();8642 const selfInvocation = yield* resolveSelfInvocation();
9030 const mockAgentPath = yield* path.fromFileUrl(8643 const mockAgentPath = yield* path.fromFileUrl(
9031 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8644 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9036,8 +8649,7 @@ describe("AcpAdapterV2", () => {...@@ -9036,8 +8649,7 @@ describe("AcpAdapterV2", () => {
9036 let subagentPhase: "spawn" | "complete" = "spawn";8649 let subagentPhase: "spawn" | "complete" = "spawn";
9037 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];8650 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
9038 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;8651 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
9039 const adapter = makeAcpAdapterV2({8652 const adapter = yield* makeAcpAdapterV2({
9040 crypto: yield* Crypto.Crypto,
9041 instanceId,8653 instanceId,
9042 flavor: {8654 flavor: {
9043 driver: ACP_TEST_DRIVER,8655 driver: ACP_TEST_DRIVER,
...@@ -9084,9 +8696,6 @@ describe("AcpAdapterV2", () => {...@@ -9084,9 +8696,6 @@ describe("AcpAdapterV2", () => {
9084 }),8696 }),
9085 }),8697 }),
9086 },8698 },
9087 fileSystem,
9088 idAllocator,
9089 host,
9090 selfInvocation,8699 selfInvocation,
9091 continuationRequests: { offer: () => Effect.void },8700 continuationRequests: { offer: () => Effect.void },
9092 });8701 });
...@@ -9219,10 +8828,8 @@ describe("AcpAdapterV2", () => {...@@ -9219,10 +8828,8 @@ describe("AcpAdapterV2", () => {
9219 () =>8828 () =>
9220 Effect.gen(function* () {8829 Effect.gen(function* () {
9221 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8830 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9222 const fileSystem = yield* FileSystem.FileSystem;
9223 const idAllocator = yield* IdAllocator.IdAllocatorV2;8831 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9224 const path = yield* Path.Path;8832 const path = yield* Path.Path;
9225 const host = yield* ProviderHost.ProviderHost;
9226 const selfInvocation = yield* resolveSelfInvocation();8833 const selfInvocation = yield* resolveSelfInvocation();
9227 const mockAgentPath = yield* path.fromFileUrl(8834 const mockAgentPath = yield* path.fromFileUrl(
9228 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8835 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9238,8 +8845,7 @@ describe("AcpAdapterV2", () => {...@@ -9238,8 +8845,7 @@ describe("AcpAdapterV2", () => {
9238 // interrupt then ORs wire-done with promptSettled under the permit.8845 // interrupt then ORs wire-done with promptSettled under the permit.
9239 const promptWireReturned = yield* Deferred.make<void>();8846 const promptWireReturned = yield* Deferred.make<void>();
9240 const releasePromptCompletion = yield* Deferred.make<void>();8847 const releasePromptCompletion = yield* Deferred.make<void>();
9241 const adapter = makeAcpAdapterV2({8848 const adapter = yield* makeAcpAdapterV2({
9242 crypto: yield* Crypto.Crypto,
9243 instanceId,8849 instanceId,
9244 flavor: {8850 flavor: {
9245 driver: ACP_TEST_DRIVER,8851 driver: ACP_TEST_DRIVER,
...@@ -9295,9 +8901,6 @@ describe("AcpAdapterV2", () => {...@@ -9295,9 +8901,6 @@ describe("AcpAdapterV2", () => {
9295 }),8901 }),
9296 }),8902 }),
9297 },8903 },
9298 fileSystem,
9299 idAllocator,
9300 host,
9301 selfInvocation,8904 selfInvocation,
9302 });8905 });
9303 const threadId = ThreadId.make("thread-acp-settled-soft-admission-race");8906 const threadId = ThreadId.make("thread-acp-settled-soft-admission-race");
...@@ -9389,10 +8992,8 @@ describe("AcpAdapterV2", () => {...@@ -9389,10 +8992,8 @@ describe("AcpAdapterV2", () => {
9389 () =>8992 () =>
9390 Effect.gen(function* () {8993 Effect.gen(function* () {
9391 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;8994 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9392 const fileSystem = yield* FileSystem.FileSystem;
9393 const idAllocator = yield* IdAllocator.IdAllocatorV2;8995 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9394 const path = yield* Path.Path;8996 const path = yield* Path.Path;
9395 const host = yield* ProviderHost.ProviderHost;
9396 const selfInvocation = yield* resolveSelfInvocation();8997 const selfInvocation = yield* resolveSelfInvocation();
9397 const mockAgentPath = yield* path.fromFileUrl(8998 const mockAgentPath = yield* path.fromFileUrl(
9398 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),8999 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9400,8 +9001,7 @@ describe("AcpAdapterV2", () => {...@@ -9400,8 +9001,7 @@ describe("AcpAdapterV2", () => {
9400 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);9001 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
9401 const continuationRequests: Array<ProviderContinuationRequest> = [];9002 const continuationRequests: Array<ProviderContinuationRequest> = [];
9402 const instanceId = ProviderInstanceId.make("acp-test");9003 const instanceId = ProviderInstanceId.make("acp-test");
9403 const adapter = makeAcpAdapterV2({9004 const adapter = yield* makeAcpAdapterV2({
9404 crypto: yield* Crypto.Crypto,
9405 instanceId,9005 instanceId,
9406 flavor: {9006 flavor: {
9407 driver: ACP_TEST_DRIVER,9007 driver: ACP_TEST_DRIVER,
...@@ -9428,9 +9028,6 @@ describe("AcpAdapterV2", () => {...@@ -9428,9 +9028,6 @@ describe("AcpAdapterV2", () => {
9428 protocolEvents,9028 protocolEvents,
9429 }),9029 }),
9430 },9030 },
9431 fileSystem,
9432 idAllocator,
9433 host,
9434 selfInvocation,9031 selfInvocation,
9435 continuationRequests: {9032 continuationRequests: {
9436 offer: (request) =>9033 offer: (request) =>
...@@ -9520,10 +9117,8 @@ describe("AcpAdapterV2", () => {...@@ -9520,10 +9117,8 @@ describe("AcpAdapterV2", () => {
9520 () =>9117 () =>
9521 Effect.gen(function* () {9118 Effect.gen(function* () {
9522 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;9119 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9523 const fileSystem = yield* FileSystem.FileSystem;
9524 const idAllocator = yield* IdAllocator.IdAllocatorV2;9120 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9525 const path = yield* Path.Path;9121 const path = yield* Path.Path;
9526 const host = yield* ProviderHost.ProviderHost;
9527 const selfInvocation = yield* resolveSelfInvocation();9122 const selfInvocation = yield* resolveSelfInvocation();
9528 const mockAgentPath = yield* path.fromFileUrl(9123 const mockAgentPath = yield* path.fromFileUrl(
9529 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),9124 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9532,8 +9127,7 @@ describe("AcpAdapterV2", () => {...@@ -9532,8 +9127,7 @@ describe("AcpAdapterV2", () => {
9532 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];9127 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
9533 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;9128 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
9534 const instanceId = ProviderInstanceId.make("acp-test");9129 const instanceId = ProviderInstanceId.make("acp-test");
9535 const adapter = makeAcpAdapterV2({9130 const adapter = yield* makeAcpAdapterV2({
9536 crypto: yield* Crypto.Crypto,
9537 instanceId,9131 instanceId,
9538 flavor: {9132 flavor: {
9539 driver: ACP_TEST_DRIVER,9133 driver: ACP_TEST_DRIVER,
...@@ -9551,9 +9145,6 @@ describe("AcpAdapterV2", () => {...@@ -9551,9 +9145,6 @@ describe("AcpAdapterV2", () => {
9551 }),9145 }),
9552 }),9146 }),
9553 },9147 },
9554 fileSystem,
9555 idAllocator,
9556 host,
9557 selfInvocation,9148 selfInvocation,
9558 continuationRequests: {9149 continuationRequests: {
9559 offer: (request) =>9150 offer: (request) =>
...@@ -9640,10 +9231,8 @@ describe("AcpAdapterV2", () => {...@@ -9640,10 +9231,8 @@ describe("AcpAdapterV2", () => {
9640 it.effect("keeps a buffered continuation current when a user turn starts before dispatch", () =>9231 it.effect("keeps a buffered continuation current when a user turn starts before dispatch", () =>
9641 Effect.gen(function* () {9232 Effect.gen(function* () {
9642 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;9233 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9643 const fileSystem = yield* FileSystem.FileSystem;
9644 const idAllocator = yield* IdAllocator.IdAllocatorV2;9234 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9645 const path = yield* Path.Path;9235 const path = yield* Path.Path;
9646 const host = yield* ProviderHost.ProviderHost;
9647 const selfInvocation = yield* resolveSelfInvocation();9236 const selfInvocation = yield* resolveSelfInvocation();
9648 const mockAgentPath = yield* path.fromFileUrl(9237 const mockAgentPath = yield* path.fromFileUrl(
9649 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),9238 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9656,8 +9245,7 @@ describe("AcpAdapterV2", () => {...@@ -9656,8 +9245,7 @@ describe("AcpAdapterV2", () => {
9656 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];9245 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
9657 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;9246 let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
9658 const instanceId = ProviderInstanceId.make("acp-test");9247 const instanceId = ProviderInstanceId.make("acp-test");
9659 const adapter = makeAcpAdapterV2({9248 const adapter = yield* makeAcpAdapterV2({
9660 crypto: yield* Crypto.Crypto,
9661 instanceId,9249 instanceId,
9662 flavor: {9250 flavor: {
9663 driver: ACP_TEST_DRIVER,9251 driver: ACP_TEST_DRIVER,
...@@ -9687,9 +9275,6 @@ describe("AcpAdapterV2", () => {...@@ -9687,9 +9275,6 @@ describe("AcpAdapterV2", () => {
9687 }),9275 }),
9688 }),9276 }),
9689 },9277 },
9690 fileSystem,
9691 idAllocator,
9692 host,
9693 selfInvocation,9278 selfInvocation,
9694 continuationRequests: {9279 continuationRequests: {
9695 offer: (request) =>9280 offer: (request) =>
...@@ -9852,7 +9437,6 @@ describe("AcpAdapterV2", () => {...@@ -9852,7 +9437,6 @@ describe("AcpAdapterV2", () => {
9852 const fileSystem = yield* FileSystem.FileSystem;9437 const fileSystem = yield* FileSystem.FileSystem;
9853 const idAllocator = yield* IdAllocator.IdAllocatorV2;9438 const idAllocator = yield* IdAllocator.IdAllocatorV2;
9854 const path = yield* Path.Path;9439 const path = yield* Path.Path;
9855 const host = yield* ProviderHost.ProviderHost;
9856 const selfInvocation = yield* resolveSelfInvocation();9440 const selfInvocation = yield* resolveSelfInvocation();
9857 const mockAgentPath = yield* path.fromFileUrl(9441 const mockAgentPath = yield* path.fromFileUrl(
9858 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),9442 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -9861,8 +9445,7 @@ describe("AcpAdapterV2", () => {...@@ -9861,8 +9445,7 @@ describe("AcpAdapterV2", () => {
9861 const triggerPath = path.join(triggerDir, "report-trigger");9445 const triggerPath = path.join(triggerDir, "report-trigger");
9862 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);9446 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
9863 const instanceId = ProviderInstanceId.make("acp-test");9447 const instanceId = ProviderInstanceId.make("acp-test");
9864 const adapter = makeAcpAdapterV2({9448 const adapter = yield* makeAcpAdapterV2({
9865 crypto: yield* Crypto.Crypto,
9866 instanceId,9449 instanceId,
9867 flavor: {9450 flavor: {
9868 driver: ACP_TEST_DRIVER,9451 driver: ACP_TEST_DRIVER,
...@@ -9894,9 +9477,6 @@ describe("AcpAdapterV2", () => {...@@ -9894,9 +9477,6 @@ describe("AcpAdapterV2", () => {
9894 protocolEvents,9477 protocolEvents,
9895 }),9478 }),
9896 },9479 },
9897 fileSystem,
9898 idAllocator,
9899 host,
9900 selfInvocation,9480 selfInvocation,
9901 });9481 });
9902 const threadId = ThreadId.make("thread-acp-injected-report-hold");9482 const threadId = ThreadId.make("thread-acp-injected-report-hold");
...@@ -10018,7 +9598,6 @@ describe("AcpAdapterV2", () => {...@@ -10018,7 +9598,6 @@ describe("AcpAdapterV2", () => {
10018 const fileSystem = yield* FileSystem.FileSystem;9598 const fileSystem = yield* FileSystem.FileSystem;
10019 const idAllocator = yield* IdAllocator.IdAllocatorV2;9599 const idAllocator = yield* IdAllocator.IdAllocatorV2;
10020 const path = yield* Path.Path;9600 const path = yield* Path.Path;
10021 const host = yield* ProviderHost.ProviderHost;
10022 const selfInvocation = yield* resolveSelfInvocation();9601 const selfInvocation = yield* resolveSelfInvocation();
10023 const mockAgentPath = yield* path.fromFileUrl(9602 const mockAgentPath = yield* path.fromFileUrl(
10024 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),9603 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -10037,8 +9616,7 @@ describe("AcpAdapterV2", () => {...@@ -10037,8 +9616,7 @@ describe("AcpAdapterV2", () => {
10037 | null;9616 | null;
10038 } = { current: null };9617 } = { current: null };
10039 const instanceId = ProviderInstanceId.make("acp-test");9618 const instanceId = ProviderInstanceId.make("acp-test");
10040 const adapter = makeAcpAdapterV2({9619 const adapter = yield* makeAcpAdapterV2({
10041 crypto: yield* Crypto.Crypto,
10042 instanceId,9620 instanceId,
10043 flavor: {9621 flavor: {
10044 driver: ACP_TEST_DRIVER,9622 driver: ACP_TEST_DRIVER,
...@@ -10075,9 +9653,6 @@ describe("AcpAdapterV2", () => {...@@ -10075,9 +9653,6 @@ describe("AcpAdapterV2", () => {
10075 protocolEvents,9653 protocolEvents,
10076 }),9654 }),
10077 },9655 },
10078 fileSystem,
10079 idAllocator,
10080 host,
10081 selfInvocation,9656 selfInvocation,
10082 continuationRequests: {9657 continuationRequests: {
10083 offer: (request) =>9658 offer: (request) =>
...@@ -10217,10 +9792,8 @@ describe("AcpAdapterV2", () => {...@@ -10217,10 +9792,8 @@ describe("AcpAdapterV2", () => {
10217 () =>9792 () =>
10218 Effect.gen(function* () {9793 Effect.gen(function* () {
10219 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;9794 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10220 const fileSystem = yield* FileSystem.FileSystem;
10221 const idAllocator = yield* IdAllocator.IdAllocatorV2;9795 const idAllocator = yield* IdAllocator.IdAllocatorV2;
10222 const path = yield* Path.Path;9796 const path = yield* Path.Path;
10223 const host = yield* ProviderHost.ProviderHost;
10224 const selfInvocation = yield* resolveSelfInvocation();9797 const selfInvocation = yield* resolveSelfInvocation();
10225 const mockAgentPath = yield* path.fromFileUrl(9798 const mockAgentPath = yield* path.fromFileUrl(
10226 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),9799 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -10240,8 +9813,7 @@ describe("AcpAdapterV2", () => {...@@ -10240,8 +9813,7 @@ describe("AcpAdapterV2", () => {
10240 | null;9813 | null;
10241 } = { current: null };9814 } = { current: null };
10242 const instanceId = ProviderInstanceId.make("acp-test");9815 const instanceId = ProviderInstanceId.make("acp-test");
10243 const adapter = makeAcpAdapterV2({9816 const adapter = yield* makeAcpAdapterV2({
10244 crypto: yield* Crypto.Crypto,
10245 instanceId,9817 instanceId,
10246 flavor: {9818 flavor: {
10247 driver: ACP_TEST_DRIVER,9819 driver: ACP_TEST_DRIVER,
...@@ -10273,9 +9845,6 @@ describe("AcpAdapterV2", () => {...@@ -10273,9 +9845,6 @@ describe("AcpAdapterV2", () => {
10273 }),9845 }),
10274 }),9846 }),
10275 },9847 },
10276 fileSystem,
10277 idAllocator,
10278 host,
10279 selfInvocation,9848 selfInvocation,
10280 continuationRequests: {9849 continuationRequests: {
10281 offer: (request) =>9850 offer: (request) =>
...@@ -10457,10 +10026,8 @@ describe("AcpAdapterV2", () => {...@@ -10457,10 +10026,8 @@ describe("AcpAdapterV2", () => {
10457 () =>10026 () =>
10458 Effect.gen(function* () {10027 Effect.gen(function* () {
10459 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;10028 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10460 const fileSystem = yield* FileSystem.FileSystem;
10461 const idAllocator = yield* IdAllocator.IdAllocatorV2;10029 const idAllocator = yield* IdAllocator.IdAllocatorV2;
10462 const path = yield* Path.Path;10030 const path = yield* Path.Path;
10463 const host = yield* ProviderHost.ProviderHost;
10464 const selfInvocation = yield* resolveSelfInvocation();10031 const selfInvocation = yield* resolveSelfInvocation();
10465 const mockAgentPath = yield* path.fromFileUrl(10032 const mockAgentPath = yield* path.fromFileUrl(
10466 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),10033 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -10480,8 +10047,7 @@ describe("AcpAdapterV2", () => {...@@ -10480,8 +10047,7 @@ describe("AcpAdapterV2", () => {
10480 | null;10047 | null;
10481 } = { current: null };10048 } = { current: null };
10482 const instanceId = ProviderInstanceId.make("acp-test");10049 const instanceId = ProviderInstanceId.make("acp-test");
10483 const adapter = makeAcpAdapterV2({10050 const adapter = yield* makeAcpAdapterV2({
10484 crypto: yield* Crypto.Crypto,
10485 instanceId,10051 instanceId,
10486 flavor: {10052 flavor: {
10487 driver: ACP_TEST_DRIVER,10053 driver: ACP_TEST_DRIVER,
...@@ -10520,9 +10086,6 @@ describe("AcpAdapterV2", () => {...@@ -10520,9 +10086,6 @@ describe("AcpAdapterV2", () => {
10520 }),10086 }),
10521 }),10087 }),
10522 },10088 },
10523 fileSystem,
10524 idAllocator,
10525 host,
10526 selfInvocation,10089 selfInvocation,
10527 continuationRequests: {10090 continuationRequests: {
10528 offer: (request) =>10091 offer: (request) =>
...@@ -10676,10 +10239,8 @@ describe("AcpAdapterV2", () => {...@@ -10676,10 +10239,8 @@ describe("AcpAdapterV2", () => {
10676 () =>10239 () =>
10677 Effect.gen(function* () {10240 Effect.gen(function* () {
10678 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;10241 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10679 const fileSystem = yield* FileSystem.FileSystem;
10680 const idAllocator = yield* IdAllocator.IdAllocatorV2;10242 const idAllocator = yield* IdAllocator.IdAllocatorV2;
10681 const path = yield* Path.Path;10243 const path = yield* Path.Path;
10682 const host = yield* ProviderHost.ProviderHost;
10683 const selfInvocation = yield* resolveSelfInvocation();10244 const selfInvocation = yield* resolveSelfInvocation();
10684 const mockAgentPath = yield* path.fromFileUrl(10245 const mockAgentPath = yield* path.fromFileUrl(
10685 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),10246 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -10699,8 +10260,7 @@ describe("AcpAdapterV2", () => {...@@ -10699,8 +10260,7 @@ describe("AcpAdapterV2", () => {
10699 | null;10260 | null;
10700 } = { current: null };10261 } = { current: null };
10701 const instanceId = ProviderInstanceId.make("acp-test");10262 const instanceId = ProviderInstanceId.make("acp-test");
10702 const adapter = makeAcpAdapterV2({10263 const adapter = yield* makeAcpAdapterV2({
10703 crypto: yield* Crypto.Crypto,
10704 instanceId,10264 instanceId,
10705 flavor: {10265 flavor: {
10706 driver: ACP_TEST_DRIVER,10266 driver: ACP_TEST_DRIVER,
...@@ -10743,9 +10303,6 @@ describe("AcpAdapterV2", () => {...@@ -10743,9 +10303,6 @@ describe("AcpAdapterV2", () => {
10743 }),10303 }),
10744 }),10304 }),
10745 },10305 },
10746 fileSystem,
10747 idAllocator,
10748 host,
10749 selfInvocation,10306 selfInvocation,
10750 continuationRequests: {10307 continuationRequests: {
10751 offer: (request) =>10308 offer: (request) =>
...@@ -10891,10 +10448,8 @@ describe("AcpAdapterV2", () => {...@@ -10891,10 +10448,8 @@ describe("AcpAdapterV2", () => {
10891 () =>10448 () =>
10892 Effect.gen(function* () {10449 Effect.gen(function* () {
10893 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;10450 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10894 const fileSystem = yield* FileSystem.FileSystem;
10895 const idAllocator = yield* IdAllocator.IdAllocatorV2;10451 const idAllocator = yield* IdAllocator.IdAllocatorV2;
10896 const path = yield* Path.Path;10452 const path = yield* Path.Path;
10897 const host = yield* ProviderHost.ProviderHost;
10898 const selfInvocation = yield* resolveSelfInvocation();10453 const selfInvocation = yield* resolveSelfInvocation();
10899 const mockAgentPath = yield* path.fromFileUrl(10454 const mockAgentPath = yield* path.fromFileUrl(
10900 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),10455 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -10914,8 +10469,7 @@ describe("AcpAdapterV2", () => {...@@ -10914,8 +10469,7 @@ describe("AcpAdapterV2", () => {
10914 | null;10469 | null;
10915 } = { current: null };10470 } = { current: null };
10916 const instanceId = ProviderInstanceId.make("acp-test");10471 const instanceId = ProviderInstanceId.make("acp-test");
10917 const adapter = makeAcpAdapterV2({10472 const adapter = yield* makeAcpAdapterV2({
10918 crypto: yield* Crypto.Crypto,
10919 instanceId,10473 instanceId,
10920 flavor: {10474 flavor: {
10921 driver: ACP_TEST_DRIVER,10475 driver: ACP_TEST_DRIVER,
...@@ -10980,9 +10534,6 @@ describe("AcpAdapterV2", () => {...@@ -10980,9 +10534,6 @@ describe("AcpAdapterV2", () => {
10980 }),10534 }),
10981 }),10535 }),
10982 },10536 },
10983 fileSystem,
10984 idAllocator,
10985 host,
10986 selfInvocation,10537 selfInvocation,
10987 continuationRequests: {10538 continuationRequests: {
10988 offer: (request) =>10539 offer: (request) =>
...@@ -11263,10 +10814,8 @@ describe("AcpAdapterV2", () => {...@@ -11263,10 +10814,8 @@ describe("AcpAdapterV2", () => {
11263 it.effect("a wake names work that ended while the previous wake was queued", () =>10814 it.effect("a wake names work that ended while the previous wake was queued", () =>
11264 Effect.gen(function* () {10815 Effect.gen(function* () {
11265 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;10816 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11266 const fileSystem = yield* FileSystem.FileSystem;
11267 const idAllocator = yield* IdAllocator.IdAllocatorV2;10817 const idAllocator = yield* IdAllocator.IdAllocatorV2;
11268 const path = yield* Path.Path;10818 const path = yield* Path.Path;
11269 const host = yield* ProviderHost.ProviderHost;
11270 const selfInvocation = yield* resolveSelfInvocation();10819 const selfInvocation = yield* resolveSelfInvocation();
11271 const mockAgentPath = yield* path.fromFileUrl(10820 const mockAgentPath = yield* path.fromFileUrl(
11272 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),10821 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -11277,8 +10826,7 @@ describe("AcpAdapterV2", () => {...@@ -11277,8 +10826,7 @@ describe("AcpAdapterV2", () => {
11277 let applyMutation: AcpAdapterV2ExtensionContext["applyBackgroundTaskMutation"] | undefined;10826 let applyMutation: AcpAdapterV2ExtensionContext["applyBackgroundTaskMutation"] | undefined;
11278 const promptGate = yield* Deferred.make<EffectAcpSchema.PromptResponse>();10827 const promptGate = yield* Deferred.make<EffectAcpSchema.PromptResponse>();
11279 const instanceId = ProviderInstanceId.make("acp-test");10828 const instanceId = ProviderInstanceId.make("acp-test");
11280 const adapter = makeAcpAdapterV2({10829 const adapter = yield* makeAcpAdapterV2({
11281 crypto: yield* Crypto.Crypto,
11282 instanceId,10830 instanceId,
11283 flavor: {10831 flavor: {
11284 driver: ACP_TEST_DRIVER,10832 driver: ACP_TEST_DRIVER,
...@@ -11303,9 +10851,6 @@ describe("AcpAdapterV2", () => {...@@ -11303,9 +10851,6 @@ describe("AcpAdapterV2", () => {
11303 }),10851 }),
11304 }),10852 }),
11305 },10853 },
11306 fileSystem,
11307 idAllocator,
11308 host,
11309 selfInvocation,10854 selfInvocation,
11310 continuationRequests: {10855 continuationRequests: {
11311 offer: (request) =>10856 offer: (request) =>
...@@ -11417,10 +10962,8 @@ describe("AcpAdapterV2", () => {...@@ -11417,10 +10962,8 @@ describe("AcpAdapterV2", () => {
11417 it.effect("mid-turn completed mutation defers offer until finalize only when unhandled", () =>10962 it.effect("mid-turn completed mutation defers offer until finalize only when unhandled", () =>
11418 Effect.gen(function* () {10963 Effect.gen(function* () {
11419 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;10964 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11420 const fileSystem = yield* FileSystem.FileSystem;
11421 const idAllocator = yield* IdAllocator.IdAllocatorV2;10965 const idAllocator = yield* IdAllocator.IdAllocatorV2;
11422 const path = yield* Path.Path;10966 const path = yield* Path.Path;
11423 const host = yield* ProviderHost.ProviderHost;
11424 const selfInvocation = yield* resolveSelfInvocation();10967 const selfInvocation = yield* resolveSelfInvocation();
11425 const mockAgentPath = yield* path.fromFileUrl(10968 const mockAgentPath = yield* path.fromFileUrl(
11426 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),10969 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -11440,8 +10983,7 @@ describe("AcpAdapterV2", () => {...@@ -11440,8 +10983,7 @@ describe("AcpAdapterV2", () => {
11440 | null;10983 | null;
11441 } = { current: null };10984 } = { current: null };
11442 const instanceId = ProviderInstanceId.make("acp-test");10985 const instanceId = ProviderInstanceId.make("acp-test");
11443 const adapter = makeAcpAdapterV2({10986 const adapter = yield* makeAcpAdapterV2({
11444 crypto: yield* Crypto.Crypto,
11445 instanceId,10987 instanceId,
11446 flavor: {10988 flavor: {
11447 driver: ACP_TEST_DRIVER,10989 driver: ACP_TEST_DRIVER,
...@@ -11487,9 +11029,6 @@ describe("AcpAdapterV2", () => {...@@ -11487,9 +11029,6 @@ describe("AcpAdapterV2", () => {
11487 }),11029 }),
11488 }),11030 }),
11489 },11031 },
11490 fileSystem,
11491 idAllocator,
11492 host,
11493 selfInvocation,11032 selfInvocation,
11494 continuationRequests: {11033 continuationRequests: {
11495 offer: (request) =>11034 offer: (request) =>
...@@ -11748,10 +11287,8 @@ describe("AcpAdapterV2", () => {...@@ -11748,10 +11287,8 @@ describe("AcpAdapterV2", () => {
11748 () =>11287 () =>
11749 Effect.gen(function* () {11288 Effect.gen(function* () {
11750 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;11289 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11751 const fileSystem = yield* FileSystem.FileSystem;
11752 const idAllocator = yield* IdAllocator.IdAllocatorV2;11290 const idAllocator = yield* IdAllocator.IdAllocatorV2;
11753 const path = yield* Path.Path;11291 const path = yield* Path.Path;
11754 const host = yield* ProviderHost.ProviderHost;
11755 const selfInvocation = yield* resolveSelfInvocation();11292 const selfInvocation = yield* resolveSelfInvocation();
11756 const mockAgentPath = yield* path.fromFileUrl(11293 const mockAgentPath = yield* path.fromFileUrl(
11757 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),11294 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -11771,8 +11308,7 @@ describe("AcpAdapterV2", () => {...@@ -11771,8 +11308,7 @@ describe("AcpAdapterV2", () => {
11771 | null;11308 | null;
11772 } = { current: null };11309 } = { current: null };
11773 const instanceId = ProviderInstanceId.make("acp-test");11310 const instanceId = ProviderInstanceId.make("acp-test");
11774 const adapter = makeAcpAdapterV2({11311 const adapter = yield* makeAcpAdapterV2({
11775 crypto: yield* Crypto.Crypto,
11776 instanceId,11312 instanceId,
11777 flavor: {11313 flavor: {
11778 driver: ACP_TEST_DRIVER,11314 driver: ACP_TEST_DRIVER,
...@@ -11799,9 +11335,6 @@ describe("AcpAdapterV2", () => {...@@ -11799,9 +11335,6 @@ describe("AcpAdapterV2", () => {
11799 }),11335 }),
11800 }),11336 }),
11801 },11337 },
11802 fileSystem,
11803 idAllocator,
11804 host,
11805 selfInvocation,11338 selfInvocation,
11806 continuationRequests: {11339 continuationRequests: {
11807 offer: (request) =>11340 offer: (request) =>
...@@ -11935,10 +11468,8 @@ describe("AcpAdapterV2", () => {...@@ -11935,10 +11468,8 @@ describe("AcpAdapterV2", () => {
11935 it.effect("empty-drain continuation turn waits the quiet window so late frames can attach", () =>11468 it.effect("empty-drain continuation turn waits the quiet window so late frames can attach", () =>
11936 Effect.gen(function* () {11469 Effect.gen(function* () {
11937 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;11470 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
11938 const fileSystem = yield* FileSystem.FileSystem;
11939 const idAllocator = yield* IdAllocator.IdAllocatorV2;11471 const idAllocator = yield* IdAllocator.IdAllocatorV2;
11940 const path = yield* Path.Path;11472 const path = yield* Path.Path;
11941 const host = yield* ProviderHost.ProviderHost;
11942 const selfInvocation = yield* resolveSelfInvocation();11473 const selfInvocation = yield* resolveSelfInvocation();
11943 const mockAgentPath = yield* path.fromFileUrl(11474 const mockAgentPath = yield* path.fromFileUrl(
11944 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),11475 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -11958,8 +11489,7 @@ describe("AcpAdapterV2", () => {...@@ -11958,8 +11489,7 @@ describe("AcpAdapterV2", () => {
11958 | null;11489 | null;
11959 } = { current: null };11490 } = { current: null };
11960 const instanceId = ProviderInstanceId.make("acp-test");11491 const instanceId = ProviderInstanceId.make("acp-test");
11961 const adapter = makeAcpAdapterV2({11492 const adapter = yield* makeAcpAdapterV2({
11962 crypto: yield* Crypto.Crypto,
11963 instanceId,11493 instanceId,
11964 flavor: {11494 flavor: {
11965 driver: ACP_TEST_DRIVER,11495 driver: ACP_TEST_DRIVER,
...@@ -11990,9 +11520,6 @@ describe("AcpAdapterV2", () => {...@@ -11990,9 +11520,6 @@ describe("AcpAdapterV2", () => {
11990 }),11520 }),
11991 }),11521 }),
11992 },11522 },
11993 fileSystem,
11994 idAllocator,
11995 host,
11996 selfInvocation,11523 selfInvocation,
11997 continuationRequests: {11524 continuationRequests: {
11998 offer: (request) =>11525 offer: (request) =>
...@@ -12179,10 +11706,8 @@ describe("AcpAdapterV2", () => {...@@ -12179,10 +11706,8 @@ describe("AcpAdapterV2", () => {
12179 it.effect("empty-drain continuation turn finalizes after the quiet window with no frames", () =>11706 it.effect("empty-drain continuation turn finalizes after the quiet window with no frames", () =>
12180 Effect.gen(function* () {11707 Effect.gen(function* () {
12181 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;11708 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12182 const fileSystem = yield* FileSystem.FileSystem;
12183 const idAllocator = yield* IdAllocator.IdAllocatorV2;11709 const idAllocator = yield* IdAllocator.IdAllocatorV2;
12184 const path = yield* Path.Path;11710 const path = yield* Path.Path;
12185 const host = yield* ProviderHost.ProviderHost;
12186 const selfInvocation = yield* resolveSelfInvocation();11711 const selfInvocation = yield* resolveSelfInvocation();
12187 const mockAgentPath = yield* path.fromFileUrl(11712 const mockAgentPath = yield* path.fromFileUrl(
12188 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),11713 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -12202,8 +11727,7 @@ describe("AcpAdapterV2", () => {...@@ -12202,8 +11727,7 @@ describe("AcpAdapterV2", () => {
12202 | null;11727 | null;
12203 } = { current: null };11728 } = { current: null };
12204 const instanceId = ProviderInstanceId.make("acp-test");11729 const instanceId = ProviderInstanceId.make("acp-test");
12205 const adapter = makeAcpAdapterV2({11730 const adapter = yield* makeAcpAdapterV2({
12206 crypto: yield* Crypto.Crypto,
12207 instanceId,11731 instanceId,
12208 flavor: {11732 flavor: {
12209 driver: ACP_TEST_DRIVER,11733 driver: ACP_TEST_DRIVER,
...@@ -12232,9 +11756,6 @@ describe("AcpAdapterV2", () => {...@@ -12232,9 +11756,6 @@ describe("AcpAdapterV2", () => {
12232 }),11756 }),
12233 }),11757 }),
12234 },11758 },
12235 fileSystem,
12236 idAllocator,
12237 host,
12238 selfInvocation,11759 selfInvocation,
12239 continuationRequests: {11760 continuationRequests: {
12240 offer: (request) =>11761 offer: (request) =>
...@@ -12369,18 +11890,15 @@ describe("AcpAdapterV2", () => {...@@ -12369,18 +11890,15 @@ describe("AcpAdapterV2", () => {
12369 it.effect("restarts the ACP child process before the next prompt after interrupt", () =>11890 it.effect("restarts the ACP child process before the next prompt after interrupt", () =>
12370 Effect.gen(function* () {11891 Effect.gen(function* () {
12371 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;11892 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12372 const fileSystem = yield* FileSystem.FileSystem;
12373 const idAllocator = yield* IdAllocator.IdAllocatorV2;11893 const idAllocator = yield* IdAllocator.IdAllocatorV2;
12374 const path = yield* Path.Path;11894 const path = yield* Path.Path;
12375 const host = yield* ProviderHost.ProviderHost;
12376 const selfInvocation = yield* resolveSelfInvocation();11895 const selfInvocation = yield* resolveSelfInvocation();
12377 const mockAgentPath = yield* path.fromFileUrl(11896 const mockAgentPath = yield* path.fromFileUrl(
12378 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),11897 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
12379 );11898 );
12380 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);11899 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
12381 const instanceId = ProviderInstanceId.make("acp-test");11900 const instanceId = ProviderInstanceId.make("acp-test");
12382 const adapter = makeAcpAdapterV2({11901 const adapter = yield* makeAcpAdapterV2({
12383 crypto: yield* Crypto.Crypto,
12384 instanceId,11902 instanceId,
12385 flavor: {11903 flavor: {
12386 driver: ACP_TEST_DRIVER,11904 driver: ACP_TEST_DRIVER,
...@@ -12392,9 +11910,6 @@ describe("AcpAdapterV2", () => {...@@ -12392,9 +11910,6 @@ describe("AcpAdapterV2", () => {
12392 protocolEvents,11910 protocolEvents,
12393 }),11911 }),
12394 },11912 },
12395 fileSystem,
12396 idAllocator,
12397 host,
12398 selfInvocation,11913 selfInvocation,
12399 });11914 });
12400 const threadId = ThreadId.make("thread-acp-restart-after-interrupt");11915 const threadId = ThreadId.make("thread-acp-restart-after-interrupt");
...@@ -12618,7 +12133,6 @@ describe("AcpAdapterV2", () => {...@@ -12618,7 +12133,6 @@ describe("AcpAdapterV2", () => {
12618 const fileSystem = yield* FileSystem.FileSystem;12133 const fileSystem = yield* FileSystem.FileSystem;
12619 const idAllocator = yield* IdAllocator.IdAllocatorV2;12134 const idAllocator = yield* IdAllocator.IdAllocatorV2;
12620 const path = yield* Path.Path;12135 const path = yield* Path.Path;
12621 const host = yield* ProviderHost.ProviderHost;
12622 const selfInvocation = yield* resolveSelfInvocation();12136 const selfInvocation = yield* resolveSelfInvocation();
12623 const mockAgentPath = yield* path.fromFileUrl(12137 const mockAgentPath = yield* path.fromFileUrl(
12624 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),12138 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -12635,8 +12149,7 @@ describe("AcpAdapterV2", () => {...@@ -12635,8 +12149,7 @@ describe("AcpAdapterV2", () => {
12635 const releaseTeardown = yield* Deferred.make<void>();12149 const releaseTeardown = yield* Deferred.make<void>();
12636 let terminatorCallCount = 0;12150 let terminatorCallCount = 0;
12637 const instanceId = ProviderInstanceId.make("acp-test");12151 const instanceId = ProviderInstanceId.make("acp-test");
12638 const adapter = makeAcpAdapterV2({12152 const adapter = yield* makeAcpAdapterV2({
12639 crypto: yield* Crypto.Crypto,
12640 instanceId,12153 instanceId,
12641 flavor: {12154 flavor: {
12642 driver: ACP_TEST_DRIVER,12155 driver: ACP_TEST_DRIVER,
...@@ -12665,9 +12178,6 @@ describe("AcpAdapterV2", () => {...@@ -12665,9 +12178,6 @@ describe("AcpAdapterV2", () => {
12665 protocolEvents,12178 protocolEvents,
12666 }),12179 }),
12667 },12180 },
12668 fileSystem,
12669 idAllocator,
12670 host,
12671 selfInvocation,12181 selfInvocation,
12672 continuationRequests: {12182 continuationRequests: {
12673 offer: (request) =>12183 offer: (request) =>
...@@ -12833,18 +12343,15 @@ describe("AcpAdapterV2", () => {...@@ -12833,18 +12343,15 @@ describe("AcpAdapterV2", () => {
12833 it.live("durably poisons start and resume when required hard teardown is unavailable", () =>12343 it.live("durably poisons start and resume when required hard teardown is unavailable", () =>
12834 Effect.gen(function* () {12344 Effect.gen(function* () {
12835 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;12345 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12836 const fileSystem = yield* FileSystem.FileSystem;
12837 const idAllocator = yield* IdAllocator.IdAllocatorV2;12346 const idAllocator = yield* IdAllocator.IdAllocatorV2;
12838 const path = yield* Path.Path;12347 const path = yield* Path.Path;
12839 const host = yield* ProviderHost.ProviderHost;
12840 const selfInvocation = yield* resolveSelfInvocation();12348 const selfInvocation = yield* resolveSelfInvocation();
12841 const mockAgentPath = yield* path.fromFileUrl(12349 const mockAgentPath = yield* path.fromFileUrl(
12842 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),12350 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
12843 );12351 );
12844 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);12352 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
12845 const instanceId = ProviderInstanceId.make("acp-test");12353 const instanceId = ProviderInstanceId.make("acp-test");
12846 const adapter = makeAcpAdapterV2({12354 const adapter = yield* makeAcpAdapterV2({
12847 crypto: yield* Crypto.Crypto,
12848 instanceId,12355 instanceId,
12849 flavor: {12356 flavor: {
12850 driver: ACP_TEST_DRIVER,12357 driver: ACP_TEST_DRIVER,
...@@ -12858,9 +12365,6 @@ describe("AcpAdapterV2", () => {...@@ -12858,9 +12365,6 @@ describe("AcpAdapterV2", () => {
12858 protocolEvents,12365 protocolEvents,
12859 }),12366 }),
12860 },12367 },
12861 fileSystem,
12862 idAllocator,
12863 host,
12864 selfInvocation,12368 selfInvocation,
12865 });12369 });
12866 const threadId = ThreadId.make("thread-acp-missing-hard-teardown");12370 const threadId = ThreadId.make("thread-acp-missing-hard-teardown");
...@@ -12922,10 +12426,8 @@ describe("AcpAdapterV2", () => {...@@ -12922,10 +12426,8 @@ describe("AcpAdapterV2", () => {
12922 it.live("holds concurrent startTurn behind successful hard teardown and reloads once", () =>12426 it.live("holds concurrent startTurn behind successful hard teardown and reloads once", () =>
12923 Effect.gen(function* () {12427 Effect.gen(function* () {
12924 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;12428 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
12925 const fileSystem = yield* FileSystem.FileSystem;
12926 const idAllocator = yield* IdAllocator.IdAllocatorV2;12429 const idAllocator = yield* IdAllocator.IdAllocatorV2;
12927 const path = yield* Path.Path;12430 const path = yield* Path.Path;
12928 const host = yield* ProviderHost.ProviderHost;
12929 const selfInvocation = yield* resolveSelfInvocation();12431 const selfInvocation = yield* resolveSelfInvocation();
12930 const mockAgentPath = yield* path.fromFileUrl(12432 const mockAgentPath = yield* path.fromFileUrl(
12931 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),12433 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -12935,8 +12437,7 @@ describe("AcpAdapterV2", () => {...@@ -12935,8 +12437,7 @@ describe("AcpAdapterV2", () => {
12935 const releaseTeardown = yield* Deferred.make<void>();12437 const releaseTeardown = yield* Deferred.make<void>();
12936 let runtimeOrdinalSeen = 0;12438 let runtimeOrdinalSeen = 0;
12937 const instanceId = ProviderInstanceId.make("acp-test");12439 const instanceId = ProviderInstanceId.make("acp-test");
12938 const adapter = makeAcpAdapterV2({12440 const adapter = yield* makeAcpAdapterV2({
12939 crypto: yield* Crypto.Crypto,
12940 instanceId,12441 instanceId,
12941 flavor: {12442 flavor: {
12942 driver: ACP_TEST_DRIVER,12443 driver: ACP_TEST_DRIVER,
...@@ -12960,9 +12461,6 @@ describe("AcpAdapterV2", () => {...@@ -12960,9 +12461,6 @@ describe("AcpAdapterV2", () => {
12960 protocolEvents,12461 protocolEvents,
12961 }),12462 }),
12962 },12463 },
12963 fileSystem,
12964 idAllocator,
12965 host,
12966 selfInvocation,12464 selfInvocation,
12967 });12465 });
12968 const threadId = ThreadId.make("thread-acp-concurrent-hard-teardown");12466 const threadId = ThreadId.make("thread-acp-concurrent-hard-teardown");
...@@ -13035,10 +12533,8 @@ describe("AcpAdapterV2", () => {...@@ -13035,10 +12533,8 @@ describe("AcpAdapterV2", () => {
13035 it.live("quarantines old-runtime callbacks after successful hard teardown", () =>12533 it.live("quarantines old-runtime callbacks after successful hard teardown", () =>
13036 Effect.gen(function* () {12534 Effect.gen(function* () {
13037 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;12535 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13038 const fileSystem = yield* FileSystem.FileSystem;
13039 const idAllocator = yield* IdAllocator.IdAllocatorV2;12536 const idAllocator = yield* IdAllocator.IdAllocatorV2;
13040 const path = yield* Path.Path;12537 const path = yield* Path.Path;
13041 const host = yield* ProviderHost.ProviderHost;
13042 const selfInvocation = yield* resolveSelfInvocation();12538 const selfInvocation = yield* resolveSelfInvocation();
13043 const mockAgentPath = yield* path.fromFileUrl(12539 const mockAgentPath = yield* path.fromFileUrl(
13044 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),12540 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -13101,8 +12597,7 @@ describe("AcpAdapterV2", () => {...@@ -13101,8 +12597,7 @@ describe("AcpAdapterV2", () => {
13101 };12597 };
13102 },12598 },
13103 });12599 });
13104 const adapter = makeAcpAdapterV2({12600 const adapter = yield* makeAcpAdapterV2({
13105 crypto: yield* Crypto.Crypto,
13106 instanceId,12601 instanceId,
13107 flavor: {12602 flavor: {
13108 driver: ACP_TEST_DRIVER,12603 driver: ACP_TEST_DRIVER,
...@@ -13119,9 +12614,6 @@ describe("AcpAdapterV2", () => {...@@ -13119,9 +12614,6 @@ describe("AcpAdapterV2", () => {
13119 runtimeInputs.push(runtimeInput);12614 runtimeInputs.push(runtimeInput);
13120 }).pipe(Effect.andThen(makeRuntime(runtimeInput))),12615 }).pipe(Effect.andThen(makeRuntime(runtimeInput))),
13121 },12616 },
13122 fileSystem,
13123 idAllocator,
13124 host,
13125 selfInvocation,12617 selfInvocation,
13126 testHooks: {12618 testHooks: {
13127 afterHardTeardownTransportDrained: () =>12619 afterHardTeardownTransportDrained: () =>
...@@ -13397,18 +12889,14 @@ describe("AcpAdapterV2", () => {...@@ -13397,18 +12889,14 @@ describe("AcpAdapterV2", () => {
13397 it.live("keeps stale deferred cleanup inert while replacement requests remain live", () =>12889 it.live("keeps stale deferred cleanup inert while replacement requests remain live", () =>
13398 Effect.gen(function* () {12890 Effect.gen(function* () {
13399 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;12891 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13400 const fileSystem = yield* FileSystem.FileSystem;
13401 const idAllocator = yield* IdAllocator.IdAllocatorV2;
13402 const path = yield* Path.Path;12892 const path = yield* Path.Path;
13403 const host = yield* ProviderHost.ProviderHost;
13404 const selfInvocation = yield* resolveSelfInvocation();12893 const selfInvocation = yield* resolveSelfInvocation();
13405 const mockAgentPath = yield* path.fromFileUrl(12894 const mockAgentPath = yield* path.fromFileUrl(
13406 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),12895 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
13407 );12896 );
13408 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);12897 const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
13409 const instanceId = ProviderInstanceId.make("acp-test");12898 const instanceId = ProviderInstanceId.make("acp-test");
13410 const adapter = makeAcpAdapterV2({12899 const adapter = yield* makeAcpAdapterV2({
13411 crypto: yield* Crypto.Crypto,
13412 instanceId,12900 instanceId,
13413 flavor: {12901 flavor: {
13414 driver: ACP_TEST_DRIVER,12902 driver: ACP_TEST_DRIVER,
...@@ -13425,9 +12913,6 @@ describe("AcpAdapterV2", () => {...@@ -13425,9 +12913,6 @@ describe("AcpAdapterV2", () => {
13425 protocolEvents,12913 protocolEvents,
13426 }),12914 }),
13427 },12915 },
13428 fileSystem,
13429 idAllocator,
13430 host,
13431 selfInvocation,12916 selfInvocation,
13432 });12917 });
13433 const threadId = ThreadId.make("thread-acp-stale-deferred-cleanup");12918 const threadId = ThreadId.make("thread-acp-stale-deferred-cleanup");
...@@ -13522,10 +13007,8 @@ describe("AcpAdapterV2", () => {...@@ -13522,10 +13007,8 @@ describe("AcpAdapterV2", () => {
13522 it.live("resolves owner cancellation and concurrent resume waiters after hard teardown", () =>13007 it.live("resolves owner cancellation and concurrent resume waiters after hard teardown", () =>
13523 Effect.gen(function* () {13008 Effect.gen(function* () {
13524 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;13009 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13525 const fileSystem = yield* FileSystem.FileSystem;
13526 const idAllocator = yield* IdAllocator.IdAllocatorV2;13010 const idAllocator = yield* IdAllocator.IdAllocatorV2;
13527 const path = yield* Path.Path;13011 const path = yield* Path.Path;
13528 const host = yield* ProviderHost.ProviderHost;
13529 const selfInvocation = yield* resolveSelfInvocation();13012 const selfInvocation = yield* resolveSelfInvocation();
13530 const mockAgentPath = yield* path.fromFileUrl(13013 const mockAgentPath = yield* path.fromFileUrl(
13531 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),13014 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -13535,8 +13018,7 @@ describe("AcpAdapterV2", () => {...@@ -13535,8 +13018,7 @@ describe("AcpAdapterV2", () => {
13535 const releaseTeardown = yield* Deferred.make<void>();13018 const releaseTeardown = yield* Deferred.make<void>();
13536 let runtimeOrdinalSeen = 0;13019 let runtimeOrdinalSeen = 0;
13537 const instanceId = ProviderInstanceId.make("acp-test");13020 const instanceId = ProviderInstanceId.make("acp-test");
13538 const adapter = makeAcpAdapterV2({13021 const adapter = yield* makeAcpAdapterV2({
13539 crypto: yield* Crypto.Crypto,
13540 instanceId,13022 instanceId,
13541 flavor: {13023 flavor: {
13542 driver: ACP_TEST_DRIVER,13024 driver: ACP_TEST_DRIVER,
...@@ -13560,9 +13042,6 @@ describe("AcpAdapterV2", () => {...@@ -13560,9 +13042,6 @@ describe("AcpAdapterV2", () => {
13560 protocolEvents,13042 protocolEvents,
13561 }),13043 }),
13562 },13044 },
13563 fileSystem,
13564 idAllocator,
13565 host,
13566 selfInvocation,13045 selfInvocation,
13567 });13046 });
13568 const threadId = ThreadId.make("thread-acp-concurrent-resume-teardown");13047 const threadId = ThreadId.make("thread-acp-concurrent-resume-teardown");
...@@ -13659,7 +13138,6 @@ describe("AcpAdapterV2", () => {...@@ -13659,7 +13138,6 @@ describe("AcpAdapterV2", () => {
13659 const fileSystem = yield* FileSystem.FileSystem;13138 const fileSystem = yield* FileSystem.FileSystem;
13660 const idAllocator = yield* IdAllocator.IdAllocatorV2;13139 const idAllocator = yield* IdAllocator.IdAllocatorV2;
13661 const path = yield* Path.Path;13140 const path = yield* Path.Path;
13662 const host = yield* ProviderHost.ProviderHost;
13663 const selfInvocation = yield* resolveSelfInvocation();13141 const selfInvocation = yield* resolveSelfInvocation();
13664 const mockAgentPath = yield* path.fromFileUrl(13142 const mockAgentPath = yield* path.fromFileUrl(
13665 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),13143 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -13673,8 +13151,7 @@ describe("AcpAdapterV2", () => {...@@ -13673,8 +13151,7 @@ describe("AcpAdapterV2", () => {
13673 );13151 );
13674 let cancelCalled = false;13152 let cancelCalled = false;
13675 const instanceId = ProviderInstanceId.make("acp-test");13153 const instanceId = ProviderInstanceId.make("acp-test");
13676 const adapter = makeAcpAdapterV2({13154 const adapter = yield* makeAcpAdapterV2({
13677 crypto: yield* Crypto.Crypto,
13678 instanceId,13155 instanceId,
13679 flavor: {13156 flavor: {
13680 driver: ACP_TEST_DRIVER,13157 driver: ACP_TEST_DRIVER,
...@@ -13711,9 +13188,6 @@ describe("AcpAdapterV2", () => {...@@ -13711,9 +13188,6 @@ describe("AcpAdapterV2", () => {
13711 }).pipe(Effect.andThen(Effect.never)),13188 }).pipe(Effect.andThen(Effect.never)),
13712 }),13189 }),
13713 },13190 },
13714 fileSystem,
13715 idAllocator,
13716 host,
13717 selfInvocation,13191 selfInvocation,
13718 continuationRequests: { offer: () => Effect.void },13192 continuationRequests: { offer: () => Effect.void },
13719 });13193 });
...@@ -13933,10 +13407,8 @@ describe("AcpAdapterV2", () => {...@@ -13933,10 +13407,8 @@ describe("AcpAdapterV2", () => {
13933 () =>13407 () =>
13934 Effect.gen(function* () {13408 Effect.gen(function* () {
13935 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;13409 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
13936 const fileSystem = yield* FileSystem.FileSystem;
13937 const idAllocator = yield* IdAllocator.IdAllocatorV2;13410 const idAllocator = yield* IdAllocator.IdAllocatorV2;
13938 const path = yield* Path.Path;13411 const path = yield* Path.Path;
13939 const host = yield* ProviderHost.ProviderHost;
13940 const selfInvocation = yield* resolveSelfInvocation();13412 const selfInvocation = yield* resolveSelfInvocation();
13941 const mockAgentPath = yield* path.fromFileUrl(13413 const mockAgentPath = yield* path.fromFileUrl(
13942 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),13414 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -13944,12 +13416,11 @@ describe("AcpAdapterV2", () => {...@@ -13944,12 +13416,11 @@ describe("AcpAdapterV2", () => {
13944 const instanceId = ProviderInstanceId.make("acp-test");13416 const instanceId = ProviderInstanceId.make("acp-test");
13945 let subagentPhase: "spawn" | "complete" = "spawn";13417 let subagentPhase: "spawn" | "complete" = "spawn";
13946 const promptSettled = yield* Deferred.make<void>();13418 const promptSettled = yield* Deferred.make<void>();
13947 const adapter = makeAcpAdapterV2({13419 const adapter = yield* makeAcpAdapterV2({
13948 testHooks: {13420 testHooks: {
13949 afterPromptSettledWithBackgroundWork: () =>13421 afterPromptSettledWithBackgroundWork: () =>
13950 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),13422 Deferred.succeed(promptSettled, undefined).pipe(Effect.asVoid),
13951 },13423 },
13952 crypto: yield* Crypto.Crypto,
13953 instanceId,13424 instanceId,
13954 flavor: {13425 flavor: {
13955 driver: ACP_TEST_DRIVER,13426 driver: ACP_TEST_DRIVER,
...@@ -13984,9 +13455,6 @@ describe("AcpAdapterV2", () => {...@@ -13984,9 +13455,6 @@ describe("AcpAdapterV2", () => {
13984 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },13455 environment: { T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1" },
13985 }),13456 }),
13986 },13457 },
13987 fileSystem,
13988 idAllocator,
13989 host,
13990 selfInvocation,13458 selfInvocation,
13991 });13459 });
13992 const threadId = ThreadId.make("thread-acp-direct-stop-subagent-hold");13460 const threadId = ThreadId.make("thread-acp-direct-stop-subagent-hold");
...@@ -14090,7 +13558,6 @@ describe("AcpAdapterV2", () => {...@@ -14090,7 +13558,6 @@ describe("AcpAdapterV2", () => {
14090 const fileSystem = yield* FileSystem.FileSystem;13558 const fileSystem = yield* FileSystem.FileSystem;
14091 const idAllocator = yield* IdAllocator.IdAllocatorV2;13559 const idAllocator = yield* IdAllocator.IdAllocatorV2;
14092 const path = yield* Path.Path;13560 const path = yield* Path.Path;
14093 const host = yield* ProviderHost.ProviderHost;
14094 const selfInvocation = yield* resolveSelfInvocation();13561 const selfInvocation = yield* resolveSelfInvocation();
14095 const mockAgentPath = yield* path.fromFileUrl(13562 const mockAgentPath = yield* path.fromFileUrl(
14096 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),13563 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -14103,8 +13570,7 @@ describe("AcpAdapterV2", () => {...@@ -14103,8 +13570,7 @@ describe("AcpAdapterV2", () => {
14103 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),13570 Effect.sync(() => cleanupPublishedDetachedFixture(commandPidPath)),
14104 );13571 );
14105 const instanceId = ProviderInstanceId.make("acp-test");13572 const instanceId = ProviderInstanceId.make("acp-test");
14106 const adapter = makeAcpAdapterV2({13573 const adapter = yield* makeAcpAdapterV2({
14107 crypto: yield* Crypto.Crypto,
14108 instanceId,13574 instanceId,
14109 flavor: {13575 flavor: {
14110 driver: ACP_TEST_DRIVER,13576 driver: ACP_TEST_DRIVER,
...@@ -14133,9 +13599,6 @@ describe("AcpAdapterV2", () => {...@@ -14133,9 +13599,6 @@ describe("AcpAdapterV2", () => {
14133 wrapCancel: (cancel) => cancel.pipe(Effect.andThen(Effect.sleep("250 millis"))),13599 wrapCancel: (cancel) => cancel.pipe(Effect.andThen(Effect.sleep("250 millis"))),
14134 }),13600 }),
14135 },13601 },
14136 fileSystem,
14137 idAllocator,
14138 host,
14139 selfInvocation,13602 selfInvocation,
14140 });13603 });
14141 const threadId = ThreadId.make("thread-acp-restart-active-in-process");13604 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...@@ -4,7 +4,6 @@ import { ProviderInstanceId, ProviderSessionId, ThreadId } from "@t3tools/contra
4import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";4import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
5import * as Deferred from "effect/Deferred";5import * as Deferred from "effect/Deferred";
6import * as Effect from "effect/Effect";6import * as Effect from "effect/Effect";
7import * as Crypto from "effect/Crypto";
8import * as FileSystem from "effect/FileSystem";7import * as FileSystem from "effect/FileSystem";
9import * as Layer from "effect/Layer";8import * as Layer from "effect/Layer";
10import * as Option from "effect/Option";9import * as Option from "effect/Option";
...@@ -188,8 +187,7 @@ describe("AcpRegistryAdapterV2", () => {...@@ -188,8 +187,7 @@ describe("AcpRegistryAdapterV2", () => {
188 ACP_REGISTRY_PROVIDER,187 ACP_REGISTRY_PROVIDER,
189 );188 );
190 const instanceId = ProviderInstanceId.make("acp-registry-mode-pick");189 const instanceId = ProviderInstanceId.make("acp-registry-mode-pick");
191 const adapter = makeAcpRegistryAdapterV2({190 const adapter = yield* makeAcpRegistryAdapterV2({
192 crypto: yield* Crypto.Crypto,
193 selfInvocation: yield* resolveSelfInvocation(),191 selfInvocation: yield* resolveSelfInvocation(),
194 instanceId,192 instanceId,
195 settings: yield* decodeAcpRegistryAdapterSettings({193 settings: yield* decodeAcpRegistryAdapterSettings({
...@@ -198,10 +196,7 @@ describe("AcpRegistryAdapterV2", () => {...@@ -198,10 +196,7 @@ describe("AcpRegistryAdapterV2", () => {
198 }),196 }),
199 environment: {},197 environment: {},
200 childProcessSpawner,198 childProcessSpawner,
201 fileSystem,
202 idAllocator: yield* IdAllocator.IdAllocatorV2,
203 resolver: { resolve: () => Effect.die("the runtime is injected") },199 resolver: { resolve: () => Effect.die("the runtime is injected") },
204 host: yield* ProviderHost.ProviderHost,
205 makeRuntime: makeAcpReplayRuntime({200 makeRuntime: makeAcpReplayRuntime({
206 transcript,201 transcript,
207 statusPath,202 statusPath,
...@@ -268,10 +263,7 @@ describe("AcpRegistryAdapterV2", () => {...@@ -268,10 +263,7 @@ describe("AcpRegistryAdapterV2", () => {
268 it.effect("offers client terminals to Devin only and client fs to no registry agent", () =>263 it.effect("offers client terminals to Devin only and client fs to no registry agent", () =>
269 Effect.gen(function* () {264 Effect.gen(function* () {
270 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;265 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
271 const fileSystem = yield* FileSystem.FileSystem;
272 const idAllocator = yield* IdAllocator.IdAllocatorV2;
273 const path = yield* Path.Path;266 const path = yield* Path.Path;
274 const host = yield* ProviderHost.ProviderHost;
275 const mockAgentPath = yield* path.fromFileUrl(267 const mockAgentPath = yield* path.fromFileUrl(
276 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),268 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
277 );269 );
...@@ -280,17 +272,13 @@ describe("AcpRegistryAdapterV2", () => {...@@ -280,17 +272,13 @@ describe("AcpRegistryAdapterV2", () => {
280 ) {272 ) {
281 let clientCapabilities: unknown;273 let clientCapabilities: unknown;
282 const instanceId = ProviderInstanceId.make(`acp-registry-capabilities-${agentId}`);274 const instanceId = ProviderInstanceId.make(`acp-registry-capabilities-${agentId}`);
283 const adapter = makeAcpRegistryAdapterV2({275 const adapter = yield* makeAcpRegistryAdapterV2({
284 crypto: yield* Crypto.Crypto,
285 selfInvocation: yield* resolveSelfInvocation(),276 selfInvocation: yield* resolveSelfInvocation(),
286 instanceId,277 instanceId,
287 settings: yield* decodeAcpRegistryAdapterSettings({ agentId, authMethodId: "test" }),278 settings: yield* decodeAcpRegistryAdapterSettings({ agentId, authMethodId: "test" }),
288 environment: {},279 environment: {},
289 childProcessSpawner,280 childProcessSpawner,
290 fileSystem,
291 idAllocator,
292 resolver: { resolve: () => Effect.die("the runtime is injected") },281 resolver: { resolve: () => Effect.die("the runtime is injected") },
293 host,
294 makeRuntime: (input) =>282 makeRuntime: (input) =>
295 Effect.gen(function* () {283 Effect.gen(function* () {
296 clientCapabilities = input.clientCapabilities;284 clientCapabilities = input.clientCapabilities;
...@@ -344,8 +332,6 @@ describe("AcpRegistryAdapterV2", () => {...@@ -344,8 +332,6 @@ describe("AcpRegistryAdapterV2", () => {
344 it.effect("opens a real ACP child process resolved from registry configuration", () =>332 it.effect("opens a real ACP child process resolved from registry configuration", () =>
345 Effect.gen(function* () {333 Effect.gen(function* () {
346 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;334 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
347 const fileSystem = yield* FileSystem.FileSystem;
348 const idAllocator = yield* IdAllocator.IdAllocatorV2;
349 const path = yield* Path.Path;335 const path = yield* Path.Path;
350 const host = yield* ProviderHost.ProviderHost;336 const host = yield* ProviderHost.ProviderHost;
351 const mockAgentPath = yield* path.fromFileUrl(337 const mockAgentPath = yield* path.fromFileUrl(
...@@ -369,8 +355,7 @@ describe("AcpRegistryAdapterV2", () => {...@@ -369,8 +355,7 @@ describe("AcpRegistryAdapterV2", () => {
369 readonly commands: AcpRegistryAvailableCommands;355 readonly commands: AcpRegistryAvailableCommands;
370 }>();356 }>();
371 const configurationPublished = yield* Deferred.make<AcpRegistryLiveConfiguration>();357 const configurationPublished = yield* Deferred.make<AcpRegistryLiveConfiguration>();
372 const adapter = makeAcpRegistryAdapterV2({358 const adapter = yield* makeAcpRegistryAdapterV2({
373 crypto: yield* Crypto.Crypto,
374 selfInvocation: yield* resolveSelfInvocation(),359 selfInvocation: yield* resolveSelfInvocation(),
375 instanceId,360 instanceId,
376 settings,361 settings,
...@@ -379,8 +364,6 @@ describe("AcpRegistryAdapterV2", () => {...@@ -379,8 +364,6 @@ describe("AcpRegistryAdapterV2", () => {
379 T3_ACP_COMMAND_ADVERTISEMENT_DELAY_MS: "750",364 T3_ACP_COMMAND_ADVERTISEMENT_DELAY_MS: "750",
380 },365 },
381 childProcessSpawner,366 childProcessSpawner,
382 fileSystem,
383 idAllocator,
384 runtimeCoordinator: {367 runtimeCoordinator: {
385 withForegroundStartup: (agentId, effect) =>368 withForegroundStartup: (agentId, effect) =>
386 Effect.acquireUseRelease(369 Effect.acquireUseRelease(
...@@ -428,7 +411,6 @@ describe("AcpRegistryAdapterV2", () => {...@@ -428,7 +411,6 @@ describe("AcpRegistryAdapterV2", () => {
428 })),411 })),
429 ),412 ),
430 },413 },
431 host,
432 });414 });
433 const threadId = ThreadId.make("thread-acp-registry-fixture");415 const threadId = ThreadId.make("thread-acp-registry-fixture");
434 const runtimePolicy = ProviderAdapterV2RuntimePolicy.make({416 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";...@@ -2,14 +2,12 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
2import { AcpRegistrySettings } from "@t3tools/contracts";2import { AcpRegistrySettings } from "@t3tools/contracts";
3import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";3import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
4import * as Effect from "effect/Effect";4import * as Effect from "effect/Effect";
5import * as Crypto from "effect/Crypto";
6import * as FileSystem from "effect/FileSystem";5import * as FileSystem from "effect/FileSystem";
7import * as Layer from "effect/Layer";6import * as Layer from "effect/Layer";
8import * as Path from "effect/Path";7import * as Path from "effect/Path";
9import * as Schema from "effect/Schema";8import * as Schema from "effect/Schema";
10import { ChildProcessSpawner } from "effect/process";9import { ChildProcessSpawner } from "effect/process";
1110
12import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
13import { layerTestProviderHost } from "@t3tools/provider-testing/host";11import { layerTestProviderHost } from "@t3tools/provider-testing/host";
14import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";12import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
15import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";13import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
...@@ -44,9 +42,6 @@ function layerAcpRegistryProviderAdapterRegistryReplay(...@@ -44,9 +42,6 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
44 const fileSystem = yield* FileSystem.FileSystem;42 const fileSystem = yield* FileSystem.FileSystem;
45 const path = yield* Path.Path;43 const path = yield* Path.Path;
46 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;44 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
47 const crypto = yield* Crypto.Crypto;
48 const idAllocator = yield* IdAllocator.IdAllocatorV2;
49 const host = yield* ProviderHost.ProviderHost;
50 const replayGate = options.replayGate;45 const replayGate = options.replayGate;
51 const replayDir = yield* fileSystem46 const replayDir = yield* fileSystem
52 .makeTempDirectory({47 .makeTempDirectory({
...@@ -57,18 +52,14 @@ function layerAcpRegistryProviderAdapterRegistryReplay(...@@ -57,18 +52,14 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
57 const scriptPath = yield* path52 const scriptPath = yield* path
58 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))53 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))
59 .pipe(Effect.orDie);54 .pipe(Effect.orDie);
60 const adapter = makeAcpRegistryAdapterV2({55 const adapter = yield* makeAcpRegistryAdapterV2({
61 instanceId: ACP_REGISTRY_DEFAULT_INSTANCE_ID,56 instanceId: ACP_REGISTRY_DEFAULT_INSTANCE_ID,
62 settings: REPLAY_SETTINGS,57 settings: REPLAY_SETTINGS,
63 environment: {},58 environment: {},
64 childProcessSpawner,59 childProcessSpawner,
65 crypto,
66 fileSystem,
67 idAllocator,
68 resolver: {60 resolver: {
69 resolve: () => Effect.die("ACP registry resolver must not run during replay"),61 resolve: () => Effect.die("ACP registry resolver must not run during replay"),
70 },62 },
71 host,
72 selfInvocation: yield* resolveSelfInvocation(),63 selfInvocation: yield* resolveSelfInvocation(),
73 makeRuntime: makeAcpReplayRuntime({64 makeRuntime: makeAcpReplayRuntime({
74 transcript,65 transcript,
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.ts+6-20
...@@ -59,13 +59,9 @@ export interface AcpRegistryAdapterV2Options {...@@ -59,13 +59,9 @@ export interface AcpRegistryAdapterV2Options {
59 readonly settings: AcpRegistrySettings;59 readonly settings: AcpRegistrySettings;
60 readonly environment: NodeJS.ProcessEnv;60 readonly environment: NodeJS.ProcessEnv;
61 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];61 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
62 readonly crypto: Crypto.Crypto;
63 readonly selfInvocation: SelfInvocation;62 readonly selfInvocation: SelfInvocation;
64 readonly fileSystem: FileSystem.FileSystem;
65 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
66 readonly resolver: Pick<AcpRegistrySupport.AcpRegistryCatalog["Service"], "resolve">;63 readonly resolver: Pick<AcpRegistrySupport.AcpRegistryCatalog["Service"], "resolve">;
67 readonly runtimeCoordinator?: AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator["Service"];64 readonly runtimeCoordinator?: AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator["Service"];
68 readonly host: ProviderHost.ProviderHostShape;
69 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];65 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
70 readonly makeRuntime?: (66 readonly makeRuntime?: (
71 input: AcpAdapterV2RuntimeInput,67 input: AcpAdapterV2RuntimeInput,
...@@ -181,7 +177,9 @@ function makeAcpRegistryRuntime(options: AcpRegistryAdapterV2Options) {...@@ -181,7 +177,9 @@ function makeAcpRegistryRuntime(options: AcpRegistryAdapterV2Options) {
181 });177 });
182}178}
183179
184export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {180export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(function* (
181 options: AcpRegistryAdapterV2Options,
182) {
185 const runtimeCoordinator = options.runtimeCoordinator;183 const runtimeCoordinator = options.runtimeCoordinator;
186 const registryAgentId = options.settings.source === "local" ? "" : options.settings.agentId;184 const registryAgentId = options.settings.source === "local" ? "" : options.settings.agentId;
187 const startupKey =185 const startupKey =
...@@ -237,13 +235,9 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {...@@ -237,13 +235,9 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
237 }),235 }),
238 ...(options.assertComplete === undefined ? {} : { assertComplete: options.assertComplete }),236 ...(options.assertComplete === undefined ? {} : { assertComplete: options.assertComplete }),
239 };237 };
240 return makeAcpAdapterV2({238 return yield* makeAcpAdapterV2({
241 instanceId: options.instanceId,239 instanceId: options.instanceId,
242 flavor,240 flavor,
243 crypto: options.crypto,
244 fileSystem: options.fileSystem,
245 idAllocator: options.idAllocator,
246 host: options.host,
247 selfInvocation: options.selfInvocation,241 selfInvocation: options.selfInvocation,
248 // Per-agent exception (see the note above registerMistralVibeAcpExtensions):242 // Per-agent exception (see the note above registerMistralVibeAcpExtensions):
249 // Devin runs commands through client terminals and has no ask mode over243 // Devin runs commands through client terminals and has no ask mode over
...@@ -259,7 +253,7 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {...@@ -259,7 +253,7 @@ export function makeAcpRegistryAdapterV2(options: AcpRegistryAdapterV2Options) {
259 : {}),253 : {}),
260 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),254 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
261 });255 });
262}256});
263257
264export type AcpRegistryAdapterV2DriverEnv =258export type AcpRegistryAdapterV2DriverEnv =
265 | ChildProcessSpawner.ChildProcessSpawner259 | ChildProcessSpawner.ChildProcessSpawner
...@@ -283,29 +277,21 @@ export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<...@@ -283,29 +277,21 @@ export const AcpRegistryAdapterV2Driver: ProviderAdapterDriver<
283 const hostEnvironment = yield* HostProcessEnvironment;277 const hostEnvironment = yield* HostProcessEnvironment;
284 const selfInvocation = yield* resolveSelfInvocation();278 const selfInvocation = yield* resolveSelfInvocation();
285 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;279 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
286 const crypto = yield* Crypto.Crypto;
287 const fileSystem = yield* FileSystem.FileSystem;
288 const idAllocator = yield* IdAllocator.IdAllocatorV2;
289 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;280 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
290 const host = yield* ProviderHost.ProviderHost;
291 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();281 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
292 const resolver = yield* AcpRegistrySupport.AcpRegistryCatalog;282 const resolver = yield* AcpRegistrySupport.AcpRegistryCatalog;
293 const runtimeCoordinator = yield* Effect.serviceOption(283 const runtimeCoordinator = yield* Effect.serviceOption(
294 AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator,284 AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator,
295 );285 );
296 return makeAcpRegistryAdapterV2({286 return yield* makeAcpRegistryAdapterV2({
297 instanceId: input.instanceId,287 instanceId: input.instanceId,
298 settings: { ...input.config, enabled: input.enabled },288 settings: { ...input.config, enabled: input.enabled },
299 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),289 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
300 childProcessSpawner,290 childProcessSpawner,
301 crypto,
302 fileSystem,
303 idAllocator,
304 resolver,291 resolver,
305 ...(Option.isSome(runtimeCoordinator)292 ...(Option.isSome(runtimeCoordinator)
306 ? { runtimeCoordinator: runtimeCoordinator.value }293 ? { runtimeCoordinator: runtimeCoordinator.value }
307 : {}),294 : {}),
308 host,
309 selfInvocation,295 selfInvocation,
310 nativeLogging: (threadId) =>296 nativeLogging: (threadId) =>
311 makeNativeLogger({297 makeNativeLogger({
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts+3-21
...@@ -38,7 +38,6 @@ const flavor = makeAntigravityAcpAdapterFlavor({...@@ -38,7 +38,6 @@ const flavor = makeAntigravityAcpAdapterFlavor({
38 crypto: undefined as never,38 crypto: undefined as never,
39 fileSystem: undefined as never,39 fileSystem: undefined as never,
40 path: undefined as never,40 path: undefined as never,
41 idAllocator: undefined as never,
42 host: undefined as never,41 host: undefined as never,
43 selfInvocation: undefined as never,42 selfInvocation: undefined as never,
44 makeRuntime: () => Effect.die("not spawned in this test"),43 makeRuntime: () => Effect.die("not spawned in this test"),
...@@ -149,14 +148,9 @@ describe("AntigravityAdapterV2 client file system", () => {...@@ -149,14 +148,9 @@ describe("AntigravityAdapterV2 client file system", () => {
149 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;148 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;
150 const crypto = yield* Crypto.Crypto;149 const crypto = yield* Crypto.Crypto;
151 const instanceId = ProviderInstanceId.make("antigravity-containment-test");150 const instanceId = ProviderInstanceId.make("antigravity-containment-test");
152 const adapter = makeAntigravityAdapterV2({151 const adapter = yield* makeAntigravityAdapterV2({
153 instanceId,152 instanceId,
154 crypto,
155 selfInvocation: yield* resolveSelfInvocation(),153 selfInvocation: yield* resolveSelfInvocation(),
156 fileSystem,
157 path,
158 idAllocator: yield* IdAllocator.IdAllocatorV2,
159 host,
160 makeRuntime: (input) =>154 makeRuntime: (input) =>
161 makeAntigravityAcpRuntime({155 makeAntigravityAcpRuntime({
162 ...input,156 ...input,
...@@ -293,7 +287,6 @@ describe("AntigravityAdapterV2 workspace changes", () => {...@@ -293,7 +287,6 @@ describe("AntigravityAdapterV2 workspace changes", () => {
293 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;287 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
294 const fileSystem = yield* FileSystem.FileSystem;288 const fileSystem = yield* FileSystem.FileSystem;
295 const path = yield* Path.Path;289 const path = yield* Path.Path;
296 const host = yield* ProviderHost.ProviderHost;
297 const crypto = yield* Crypto.Crypto;290 const crypto = yield* Crypto.Crypto;
298 const mockAgentPath = yield* path.fromFileUrl(291 const mockAgentPath = yield* path.fromFileUrl(
299 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),292 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -301,14 +294,9 @@ describe("AntigravityAdapterV2 workspace changes", () => {...@@ -301,14 +294,9 @@ describe("AntigravityAdapterV2 workspace changes", () => {
301 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];294 type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
302 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;295 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;
303 const instanceId = ProviderInstanceId.make("antigravity-workspace-change-test");296 const instanceId = ProviderInstanceId.make("antigravity-workspace-change-test");
304 const adapter = makeAntigravityAdapterV2({297 const adapter = yield* makeAntigravityAdapterV2({
305 instanceId,298 instanceId,
306 crypto,
307 selfInvocation: yield* resolveSelfInvocation(),299 selfInvocation: yield* resolveSelfInvocation(),
308 fileSystem,
309 path,
310 idAllocator: yield* IdAllocator.IdAllocatorV2,
311 host,
312 makeRuntime: (input) =>300 makeRuntime: (input) =>
313 makeAntigravityAcpRuntime({301 makeAntigravityAcpRuntime({
314 ...input,302 ...input,
...@@ -430,7 +418,6 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (...@@ -430,7 +418,6 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
430 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;418 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
431 const fileSystem = yield* FileSystem.FileSystem;419 const fileSystem = yield* FileSystem.FileSystem;
432 const path = yield* Path.Path;420 const path = yield* Path.Path;
433 const host = yield* ProviderHost.ProviderHost;
434 const crypto = yield* Crypto.Crypto;421 const crypto = yield* Crypto.Crypto;
435 const mockAgentPath = yield* path.fromFileUrl(422 const mockAgentPath = yield* path.fromFileUrl(
436 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),423 new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
...@@ -451,14 +438,9 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (...@@ -451,14 +438,9 @@ describe("AntigravityAdapterV2 client file system under restrictive policies", (
451 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;438 let readTextFile: Parameters<RuntimeService["handleReadTextFile"]>[0] | undefined;
452 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;439 let writeTextFile: Parameters<RuntimeService["handleWriteTextFile"]>[0] | undefined;
453 const instanceId = ProviderInstanceId.make(`antigravity-restrictive-${policy.runtimeMode}`);440 const instanceId = ProviderInstanceId.make(`antigravity-restrictive-${policy.runtimeMode}`);
454 const adapter = makeAntigravityAdapterV2({441 const adapter = yield* makeAntigravityAdapterV2({
455 instanceId,442 instanceId,
456 crypto,
457 selfInvocation: yield* resolveSelfInvocation(),443 selfInvocation: yield* resolveSelfInvocation(),
458 fileSystem,
459 path,
460 idAllocator: yield* IdAllocator.IdAllocatorV2,
461 host,
462 makeRuntime: (input) =>444 makeRuntime: (input) =>
463 makeAntigravityAcpRuntime({445 makeAntigravityAcpRuntime({
464 ...input,446 ...input,
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts+23-17
...@@ -8,8 +8,8 @@ import {...@@ -8,8 +8,8 @@ import {
8import type { SelfInvocation } from "@t3tools/shared/nodeRuntime";8import type { SelfInvocation } from "@t3tools/shared/nodeRuntime";
9import * as Crypto from "effect/Crypto";9import * as Crypto from "effect/Crypto";
10import * as Effect from "effect/Effect";10import * as Effect from "effect/Effect";
11import type * as FileSystem from "effect/FileSystem";11import * as FileSystem from "effect/FileSystem";
12import type * as Path from "effect/Path";12import * as Path from "effect/Path";
13import * as Exit from "effect/Exit";13import * as Exit from "effect/Exit";
14import * as Scope from "effect/Scope";14import * as Scope from "effect/Scope";
15import * as EffectAcpErrors from "effect-acp/errors";15import * as EffectAcpErrors from "effect-acp/errors";
...@@ -34,7 +34,6 @@ import {...@@ -34,7 +34,6 @@ import {
34 makeAntigravityUserInputResponse,34 makeAntigravityUserInputResponse,
35 normalizeAntigravityToolCall,35 normalizeAntigravityToolCall,
36} from "../../provider/acp/AntigravityProtocol.ts";36} from "../../provider/acp/AntigravityProtocol.ts";
37import type { IdAllocatorV2 } from "@t3tools/provider-core/server/IdAllocator";
38import {37import {
39 AcpProviderCapabilitiesV2,38 AcpProviderCapabilitiesV2,
40 makeAcpAdapterV2,39 makeAcpAdapterV2,
...@@ -63,12 +62,7 @@ const AntigravityProviderCapabilitiesV2 = {...@@ -63,12 +62,7 @@ const AntigravityProviderCapabilitiesV2 = {
6362
64export interface AntigravityAdapterV2Options {63export interface AntigravityAdapterV2Options {
65 readonly instanceId: ProviderInstanceId;64 readonly instanceId: ProviderInstanceId;
66 readonly crypto: Crypto.Crypto;
67 readonly selfInvocation: SelfInvocation;65 readonly selfInvocation: SelfInvocation;
68 readonly fileSystem: FileSystem.FileSystem;
69 readonly path: Path.Path;
70 readonly idAllocator: IdAllocatorV2["Service"];
71 readonly host: ProviderHost.ProviderHostShape;
72 /** Spawns the official agent with the instance's Google profile. */66 /** Spawns the official agent with the instance's Google profile. */
73 readonly makeRuntime: (67 readonly makeRuntime: (
74 input: Omit<AntigravityAcpRuntimeInput, "spawn" | "childProcessSpawner">,68 input: Omit<AntigravityAcpRuntimeInput, "spawn" | "childProcessSpawner">,
...@@ -118,8 +112,16 @@ const extractAntigravitySubagentUpdate: NonNullable<AcpAdapterV2Flavor["extractS...@@ -118,8 +112,16 @@ const extractAntigravitySubagentUpdate: NonNullable<AcpAdapterV2Flavor["extractS
118 };112 };
119};113};
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
121export function makeAntigravityAcpAdapterFlavor(123export function makeAntigravityAcpAdapterFlavor(
122 options: AntigravityAdapterV2Options,124 options: AntigravityAdapterV2Options & AntigravityFlavorServices,
123): AcpAdapterV2Flavor {125): AcpAdapterV2Flavor {
124 // The attachments dir grant lets the agent read pasted files at the paths126 // The attachments dir grant lets the agent read pasted files at the paths
125 // the turn text references. It is a leaf directory of uploads. A session127 // the turn text references. It is a leaf directory of uploads. A session
...@@ -224,18 +226,22 @@ export function makeAntigravityAcpAdapterFlavor(...@@ -224,18 +226,22 @@ export function makeAntigravityAcpAdapterFlavor(
224 };226 };
225}227}
226228
227export function makeAntigravityAdapterV2(options: AntigravityAdapterV2Options) {229export const makeAntigravityAdapterV2 = Effect.fn("makeAntigravityAdapterV2")(function* (
228 return makeAcpAdapterV2({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({
229 instanceId: options.instanceId,239 instanceId: options.instanceId,
230 flavor: makeAntigravityAcpAdapterFlavor(options),240 flavor: makeAntigravityAcpAdapterFlavor({ ...options, ...services }),
231 crypto: options.crypto,
232 fileSystem: options.fileSystem,
233 idAllocator: options.idAllocator,
234 host: options.host,
235 selfInvocation: options.selfInvocation,241 selfInvocation: options.selfInvocation,
236 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),242 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
237 ...(options.continuationRequests === undefined243 ...(options.continuationRequests === undefined
238 ? {}244 ? {}
239 : { continuationRequests: options.continuationRequests }),245 : { continuationRequests: options.continuationRequests }),
240 });246 });
241}247});
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.ts+6-15
...@@ -12,17 +12,14 @@ import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";...@@ -12,17 +12,14 @@ import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
12import * as EffectAcpErrors from "effect-acp/errors";12import * as EffectAcpErrors from "effect-acp/errors";
13import { xAiRateLimitedErrorCode } from "@t3tools/provider-grok/testing";13import { xAiRateLimitedErrorCode } from "@t3tools/provider-grok/testing";
14import { assert, describe, it } from "@effect/vitest";14import { assert, describe, it } from "@effect/vitest";
15import * as Crypto from "effect/Crypto";
16import * as DateTime from "effect/DateTime";15import * as DateTime from "effect/DateTime";
17import * as Effect from "effect/Effect";16import * as Effect from "effect/Effect";
18import * as FileSystem from "effect/FileSystem";
19import * as Layer from "effect/Layer";17import * as Layer from "effect/Layer";
20import * as PlatformError from "effect/PlatformError";18import * as PlatformError from "effect/PlatformError";
21import * as Schema from "effect/Schema";19import * as Schema from "effect/Schema";
22import { ChildProcessSpawner } from "effect/process";20import { ChildProcessSpawner } from "effect/process";
23import type * as EffectAcpSchema from "effect-acp/compat";21import type * as EffectAcpSchema from "effect-acp/compat";
2422
25import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
26import { layerTestProviderHost } from "@t3tools/provider-testing/host";23import { layerTestProviderHost } from "@t3tools/provider-testing/host";
27import * as ProjectStore from "../ProjectStore.ts";24import * as ProjectStore from "../ProjectStore.ts";
28import { buildInitialGrokProviderSnapshot } from "@t3tools/provider-grok/testing";25import { buildInitialGrokProviderSnapshot } from "@t3tools/provider-grok/testing";
...@@ -42,7 +39,6 @@ import {...@@ -42,7 +39,6 @@ import {
42 makeGrokAcpAdapterFlavor,39 makeGrokAcpAdapterFlavor,
43 makeGrokAdapterV2,40 makeGrokAdapterV2,
44 GrokProviderCapabilitiesV2,41 GrokProviderCapabilitiesV2,
45 type GrokAdapterV2Options,
46} from "@t3tools/provider-grok/testing";42} from "@t3tools/provider-grok/testing";
4743
48const LAUNCH_TEST_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({44const LAUNCH_TEST_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({
...@@ -99,7 +95,7 @@ describe("GrokAdapterV2 capabilities", () => {...@@ -99,7 +95,7 @@ describe("GrokAdapterV2 capabilities", () => {
99 it("preserves Grok's rate-limit stop and distinguishes other prompt failures", () => {95 it("preserves Grok's rate-limit stop and distinguishes other prompt failures", () => {
100 const flavor = makeGrokAcpAdapterFlavor({96 const flavor = makeGrokAcpAdapterFlavor({
101 makeRuntime: () => Effect.never,97 makeRuntime: () => Effect.never,
102 } as unknown as GrokAdapterV2Options);98 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
103 const limit = flavor.promptFailure?.(99 const limit = flavor.promptFailure?.(
104 new EffectAcpErrors.AcpRequestError({100 new EffectAcpErrors.AcpRequestError({
105 code: xAiRateLimitedErrorCode,101 code: xAiRateLimitedErrorCode,
...@@ -127,7 +123,7 @@ describe("GrokAdapterV2 capabilities", () => {...@@ -127,7 +123,7 @@ describe("GrokAdapterV2 capabilities", () => {
127 it("wires hard Stop teardown but soft non-Stop interrupts in the constructor flavor", () => {123 it("wires hard Stop teardown but soft non-Stop interrupts in the constructor flavor", () => {
128 const flavor = makeGrokAcpAdapterFlavor({124 const flavor = makeGrokAcpAdapterFlavor({
129 makeRuntime: () => Effect.never,125 makeRuntime: () => Effect.never,
130 } as unknown as GrokAdapterV2Options);126 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
131127
132 assert.isFalse(flavor.interruptPromptOnCancel);128 assert.isFalse(flavor.interruptPromptOnCancel);
133 // User Stop (requestRuntimeRestart) keeps the hard process-group kill and129 // User Stop (requestRuntimeRestart) keeps the hard process-group kill and
...@@ -144,7 +140,7 @@ describe("GrokAdapterV2 capabilities", () => {...@@ -144,7 +140,7 @@ describe("GrokAdapterV2 capabilities", () => {
144 it("terminalizes only foreground tools under the actual Grok flavor", () => {140 it("terminalizes only foreground tools under the actual Grok flavor", () => {
145 const flavor = makeGrokAcpAdapterFlavor({141 const flavor = makeGrokAcpAdapterFlavor({
146 makeRuntime: () => Effect.never,142 makeRuntime: () => Effect.never,
147 } as unknown as GrokAdapterV2Options);143 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]);
148 const foreground = {144 const foreground = {
149 toolCallId: "foreground-1",145 toolCallId: "foreground-1",
150 title: "Terminal",146 title: "Terminal",
...@@ -289,7 +285,7 @@ describe("ACP permission policy", () => {...@@ -289,7 +285,7 @@ describe("ACP permission policy", () => {
289describe("Grok permission prompts", () => {285describe("Grok permission prompts", () => {
290 const disposition = makeGrokAcpAdapterFlavor({286 const disposition = makeGrokAcpAdapterFlavor({
291 makeRuntime: () => Effect.never,287 makeRuntime: () => Effect.never,
292 } as unknown as GrokAdapterV2Options).permissionDisposition;288 } as unknown as Parameters<typeof makeGrokAcpAdapterFlavor>[0]).permissionDisposition;
293289
294 // grok_auto_blocked_command replays Auto end to end. When an explicit policy290 // grok_auto_blocked_command replays Auto end to end. When an explicit policy
295 // launches Grok asking instead, T3's policy still answers its prompts.291 // launches Grok asking instead, T3's policy still answers its prompts.
...@@ -332,18 +328,13 @@ describe("Grok launch permission mode", () => {...@@ -332,18 +328,13 @@ describe("Grok launch permission mode", () => {
332 );328 );
333 });329 });
334 const instanceId = ProviderInstanceId.make("grok-launch-test");330 const instanceId = ProviderInstanceId.make("grok-launch-test");
335 const adapter = makeGrokAdapterV2({331 const adapter = yield* makeGrokAdapterV2({
336 instanceId,332 instanceId,
337 settings: LAUNCH_TEST_GROK_SETTINGS,333 settings: LAUNCH_TEST_GROK_SETTINGS,
338 environment: {},334 environment: {},
339 hostPlatform: "darwin",335 hostPlatform: "darwin",
340 childProcessSpawner,
341 crypto: yield* Crypto.Crypto,
342 fileSystem: yield* FileSystem.FileSystem,
343 idAllocator: yield* IdAllocator.IdAllocatorV2,
344 host: yield* ProviderHost.ProviderHost,
345 selfInvocation: yield* resolveSelfInvocation(),336 selfInvocation: yield* resolveSelfInvocation(),
346 });337 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, childProcessSpawner));
347 yield* adapter338 yield* adapter
348 .openSession({339 .openSession({
349 threadId: ThreadId.make("grok-launch-test"),340 threadId: ThreadId.make("grok-launch-test"),
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.testkit.ts+1-11
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1import * as NodeServices from "@effect/platform-node/NodeServices";1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { GrokSettings } from "@t3tools/provider-grok/settings";2import { GrokSettings } from "@t3tools/provider-grok/settings";
3import * as Effect from "effect/Effect";3import * as Effect from "effect/Effect";
4import * as Crypto from "effect/Crypto";
5import * as FileSystem from "effect/FileSystem";4import * as FileSystem from "effect/FileSystem";
6import * as Layer from "effect/Layer";5import * as Layer from "effect/Layer";
7import * as Path from "effect/Path";6import * as Path from "effect/Path";
...@@ -10,7 +9,6 @@ import { ChildProcessSpawner } from "effect/process";...@@ -10,7 +9,6 @@ import { ChildProcessSpawner } from "effect/process";
10import { HostProcessPlatform } from "@t3tools/shared/hostProcess";9import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
11import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";10import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
1211
13import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
14import { layerTestProviderHost } from "@t3tools/provider-testing/host";12import { layerTestProviderHost } from "@t3tools/provider-testing/host";
15import { GROK_ACP_CANCEL_META, GROK_ACP_INITIALIZE_META } from "@t3tools/provider-grok/testing";13import { GROK_ACP_CANCEL_META, GROK_ACP_INITIALIZE_META } from "@t3tools/provider-grok/testing";
16import { makeXAiPromptCompletionRuntime } from "@t3tools/provider-grok/testing";14import { makeXAiPromptCompletionRuntime } from "@t3tools/provider-grok/testing";
...@@ -45,10 +43,7 @@ function layerGrokProviderAdapterRegistryReplay(...@@ -45,10 +43,7 @@ function layerGrokProviderAdapterRegistryReplay(
45 const fileSystem = yield* FileSystem.FileSystem;43 const fileSystem = yield* FileSystem.FileSystem;
46 const path = yield* Path.Path;44 const path = yield* Path.Path;
47 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;45 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
48 const crypto = yield* Crypto.Crypto;
49 const hostPlatform = yield* HostProcessPlatform;46 const hostPlatform = yield* HostProcessPlatform;
50 const idAllocator = yield* IdAllocator.IdAllocatorV2;
51 const host = yield* ProviderHost.ProviderHost;
52 // Same queue the continuation worker drains when the fixture runs it.47 // Same queue the continuation worker drains when the fixture runs it.
53 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;48 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
54 const replayGate = options.replayGate;49 const replayGate = options.replayGate;
...@@ -61,16 +56,11 @@ function layerGrokProviderAdapterRegistryReplay(...@@ -61,16 +56,11 @@ function layerGrokProviderAdapterRegistryReplay(
61 const scriptPath = yield* path56 const scriptPath = yield* path
62 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))57 .fromFileUrl(new URL("../../../scripts/acp-replay-agent.ts", import.meta.url))
63 .pipe(Effect.orDie);58 .pipe(Effect.orDie);
64 const adapter = makeGrokAdapterV2({59 const adapter = yield* makeGrokAdapterV2({
65 instanceId: GROK_DEFAULT_INSTANCE_ID,60 instanceId: GROK_DEFAULT_INSTANCE_ID,
66 settings: DEFAULT_GROK_SETTINGS,61 settings: DEFAULT_GROK_SETTINGS,
67 environment: {},62 environment: {},
68 hostPlatform,63 hostPlatform,
69 childProcessSpawner,
70 crypto,
71 fileSystem,
72 idAllocator,
73 host,
74 selfInvocation: yield* resolveSelfInvocation(),64 selfInvocation: yield* resolveSelfInvocation(),
75 // Same wrapping as makeGrokAcpRuntime: client type and Ctrl+C cancel65 // Same wrapping as makeGrokAcpRuntime: client type and Ctrl+C cancel
76 // metadata and the x.ai prompt-completion race, so replay sends what66 // 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 {...@@ -24,11 +24,9 @@ import {
24} from "@t3tools/contracts";24} from "@t3tools/contracts";
25import { MuseSettings } from "@t3tools/provider-muse/settings";25import { MuseSettings } from "@t3tools/provider-muse/settings";
26import * as Effect from "effect/Effect";26import * as Effect from "effect/Effect";
27import * as FileSystem from "effect/FileSystem";
28import * as Layer from "effect/Layer";27import * as Layer from "effect/Layer";
29import * as Schema from "effect/Schema";28import * as Schema from "effect/Schema";
3029
31import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
32import { layerTestProviderHost } from "@t3tools/provider-testing/host";30import { layerTestProviderHost } from "@t3tools/provider-testing/host";
33import {31import {
34 museInitializeParams,32 museInitializeParams,
...@@ -449,13 +447,10 @@ export function layer(input: {...@@ -449,13 +447,10 @@ export function layer(input: {
449 return ProviderAdapterRegistry.layerFromAdaptersEffect(447 return ProviderAdapterRegistry.layerFromAdaptersEffect(
450 Effect.gen(function* () {448 Effect.gen(function* () {
451 return [449 return [
452 makeMuseAdapterV2({450 yield* makeMuseAdapterV2({
453 instanceId: ProviderInstanceId.make(MUSE_PROVIDER_KIND),451 instanceId: ProviderInstanceId.make(MUSE_PROVIDER_KIND),
454 settings: DEFAULT_MUSE_SETTINGS,452 settings: DEFAULT_MUSE_SETTINGS,
455 environment: input.environment ?? {},453 environment: input.environment ?? {},
456 idAllocator: yield* IdAllocator.IdAllocatorV2,
457 host: yield* ProviderHost,
458 fileSystem: yield* FileSystem.FileSystem,
459 createHost: input.createHost,454 createHost: input.createHost,
460 // Same queue the continuation worker drains when the fixture runs it.455 // Same queue the continuation worker drains when the fixture runs it.
461 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,456 continuationRequests: yield* ProviderContinuationRequests.ProviderContinuationRequests,
apps/server/src/provider/Drivers/AntigravityDriver.ts+1-7
...@@ -94,7 +94,6 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD...@@ -94,7 +94,6 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
94 const installation = yield* AntigravityInstallation.AntigravityInstallation;94 const installation = yield* AntigravityInstallation.AntigravityInstallation;
95 const loggers = yield* ProviderEventLoggers.ProviderEventLoggers;95 const loggers = yield* ProviderEventLoggers.ProviderEventLoggers;
96 const modelManifest = yield* ModelManifest.ModelManifest;96 const modelManifest = yield* ModelManifest.ModelManifest;
97 const idAllocator = yield* IdAllocator.IdAllocatorV2;
98 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;97 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
99 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();98 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
100 const settings = { ...config, enabled } satisfies AntigravitySettings;99 const settings = { ...config, enabled } satisfies AntigravitySettings;
...@@ -397,13 +396,8 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD...@@ -397,13 +396,8 @@ export const AntigravityDriver: ProviderDriver<AntigravitySettings, AntigravityD
397 const defaultModel = modelManifest.current.pipe(396 const defaultModel = modelManifest.current.pipe(
398 Effect.map((manifest) => ModelManifest.manifestDefaultModel(manifest, DRIVER)),397 Effect.map((manifest) => ModelManifest.manifestDefaultModel(manifest, DRIVER)),
399 );398 );
400 const orchestrationAdapter = makeAntigravityAdapterV2({399 const orchestrationAdapter = yield* makeAntigravityAdapterV2({
401 instanceId,400 instanceId,
402 crypto,
403 fileSystem,
404 path,
405 idAllocator,
406 host,
407 selfInvocation,401 selfInvocation,
408 makeRuntime,402 makeRuntime,
409 withProcess: authFlow.withProcess,403 withProcess: authFlow.withProcess,
packages/provider-acp/src/server/adapter.ts+12-13
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1// @effect-diagnostics nodeBuiltinImport:off1// @effect-diagnostics nodeBuiltinImport:off
2import * as NodePath from "node:path";
32
4import {3import {
5 type ChatAttachment,4 type ChatAttachment,
...@@ -57,7 +56,7 @@ import type * as EffectAcpProtocol from "effect-acp/protocol";...@@ -57,7 +56,7 @@ import type * as EffectAcpProtocol from "effect-acp/protocol";
57import type * as EffectAcpSchema from "effect-acp/compat";56import type * as EffectAcpSchema from "effect-acp/compat";
5857
59import { formatReadToolLabel, formatSearchToolLabel } from "@t3tools/shared/toolActivity";58import { 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";
61import { makeAcpMcpOverAcpBridge, type AcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";60import { makeAcpMcpOverAcpBridge, type AcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
62import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation";61import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation";
63import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";62import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
...@@ -480,10 +479,6 @@ export interface AcpAdapterV2SubagentUpdate {...@@ -480,10 +479,6 @@ export interface AcpAdapterV2SubagentUpdate {
480export interface AcpAdapterV2Options {479export interface AcpAdapterV2Options {
481 readonly instanceId: ProviderInstanceId;480 readonly instanceId: ProviderInstanceId;
482 readonly flavor: AcpAdapterV2Flavor;481 readonly flavor: AcpAdapterV2Flavor;
483 readonly crypto: Crypto.Crypto;
484 readonly fileSystem: FileSystem.FileSystem;
485 readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
486 readonly host: ProviderHost.ProviderHostShape;
487 /** How agents spawn this install's `acp-mcp-bridge`; see `resolveSelfInvocation`. */482 /** How agents spawn this install's `acp-mcp-bridge`; see `resolveSelfInvocation`. */
488 readonly selfInvocation: SelfInvocation;483 readonly selfInvocation: SelfInvocation;
489 /**484 /**
...@@ -1490,10 +1485,14 @@ function shouldPersistToolUpdate(...@@ -1490,10 +1485,14 @@ function shouldPersistToolUpdate(
1490 return persist;1485 return persist;
1491}1486}
14921487
1493export function makeAcpAdapterV2(1488export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
1494 options: AcpAdapterV2Options,1489 options: AcpAdapterV2Options,
1495): ProviderAdapter.ProviderAdapterV2Shape {1490) {
1496 const { flavor, fileSystem, idAllocator, host, selfInvocation: self } = options;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;
1497 const driver = flavor.driver;1496 const driver = flavor.driver;
1498 const continuationRequests = options.continuationRequests;1497 const continuationRequests = options.continuationRequests;
1499 const postSettleContinuationEnabled =1498 const postSettleContinuationEnabled =
...@@ -5999,7 +5998,7 @@ export function makeAcpAdapterV2(...@@ -5999,7 +5998,7 @@ export function makeAcpAdapterV2(
5999 const mcpBridge = yield* makeAcpMcpOverAcpBridge({5998 const mcpBridge = yield* makeAcpMcpOverAcpBridge({
6000 endpoint: mcpContext.endpoint,5999 endpoint: mcpContext.endpoint,
6001 authorization: mcpContext.authorization,6000 authorization: mcpContext.authorization,
6002 allocateConnectionId: options.crypto.randomUUIDv4.pipe(Effect.orDie),6001 allocateConnectionId: crypto.randomUUIDv4.pipe(Effect.orDie),
6003 });6002 });
6004 yield* Scope.addFinalizer(scope, mcpBridge.dispose);6003 yield* Scope.addFinalizer(scope, mcpBridge.dispose);
6005 return mcpBridge;6004 return mcpBridge;
...@@ -6019,7 +6018,7 @@ export function makeAcpAdapterV2(...@@ -6019,7 +6018,7 @@ export function makeAcpAdapterV2(
6019 .makeRuntime(makeRuntimeInput(runtimeGeneration, threadId, resumeSessionId))6018 .makeRuntime(makeRuntimeInput(runtimeGeneration, threadId, resumeSessionId))
6020 .pipe(6019 .pipe(
6021 Effect.provideService(Scope.Scope, runtimeScope),6020 Effect.provideService(Scope.Scope, runtimeScope),
6022 Effect.provideService(Crypto.Crypto, options.crypto),6021 Effect.provideService(Crypto.Crypto, crypto),
6023 );6022 );
6024 });6023 });
60256024
...@@ -6096,7 +6095,7 @@ export function makeAcpAdapterV2(...@@ -6096,7 +6095,7 @@ export function makeAcpAdapterV2(
6096 )6095 )
6097 .pipe(6096 .pipe(
6098 Effect.provideService(Scope.Scope, replacementScope),6097 Effect.provideService(Scope.Scope, replacementScope),
6099 Effect.provideService(Crypto.Crypto, options.crypto),6098 Effect.provideService(Crypto.Crypto, crypto),
6100 );6099 );
6101 // Session setup may publish commands before it returns. Buffer those6100 // Session setup may publish commands before it returns. Buffer those
6102 // notifications, but do not expose request or extension handlers6101 // notifications, but do not expose request or extension handlers
...@@ -8049,6 +8048,6 @@ export function makeAcpAdapterV2(...@@ -8049,6 +8048,6 @@ export function makeAcpAdapterV2(
8049 ),8048 ),
8050 ),8049 ),
8051 });8050 });
8052}8051});
80538052
8054export type AcpAdapterV2Env = FileSystem.FileSystem | IdAllocator.IdAllocatorV2;8053export type AcpAdapterV2Env = FileSystem.FileSystem | IdAllocator.IdAllocatorV2;
packages/provider-core/src/server/ProviderHost.ts+2-2
...@@ -45,7 +45,7 @@ export interface ProviderCredentials {...@@ -45,7 +45,7 @@ export interface ProviderCredentials {
45 readonly remove: Effect.Effect<void, ProviderCredentialError>;45 readonly remove: Effect.Effect<void, ProviderCredentialError>;
46}46}
4747
48export interface ProviderHostShape {48interface ProviderHostService {
49 readonly paths: ProviderHostPaths;49 readonly paths: ProviderHostPaths;
50 readonly settings: {50 readonly settings: {
51 readonly get: Effect.Effect<ServerSettings, ServerSettingsError>;51 readonly get: Effect.Effect<ServerSettings, ServerSettingsError>;
...@@ -68,6 +68,6 @@ export interface ProviderHostShape {...@@ -68,6 +68,6 @@ export interface ProviderHostShape {
68 ) => Effect.Effect<ProviderCredentials>;68 ) => Effect.Effect<ProviderCredentials>;
69}69}
7070
71export class ProviderHost extends Context.Service<ProviderHost, ProviderHostShape>()(71export class ProviderHost extends Context.Service<ProviderHost, ProviderHostService>()(
72 "@t3tools/provider-core/server/ProviderHost",72 "@t3tools/provider-core/server/ProviderHost",
73) {}73) {}
packages/provider-core/src/server/managedProvider.test.ts+2-2
...@@ -99,7 +99,7 @@ const refreshedSnapshotSecond: ServerProvider = {...@@ -99,7 +99,7 @@ const refreshedSnapshotSecond: ServerProvider = {
99/** A host whose settings never change and whose background demand is fixed. */99/** A host whose settings never change and whose background demand is fixed. */
100function layerProviderHost(input: {100function layerProviderHost(input: {
101 readonly runBackgroundWork: boolean;101 readonly runBackgroundWork: boolean;
102 readonly settings?: Pick<ProviderHost.ProviderHostShape, "settings">["settings"];102 readonly settings?: Pick<ProviderHost.ProviderHost["Service"], "settings">["settings"];
103}) {103}) {
104 return Layer.succeed(104 return Layer.succeed(
105 ProviderHost.ProviderHost,105 ProviderHost.ProviderHost,
...@@ -283,7 +283,7 @@ describe("makeManagedServerProvider", () => {...@@ -283,7 +283,7 @@ describe("makeManagedServerProvider", () => {
283 };283 };
284 const serverSettingsRef = yield* Ref.make(initialServerSettings);284 const serverSettingsRef = yield* Ref.make(initialServerSettings);
285 const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>();285 const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>();
286 const hostSettings: ProviderHost.ProviderHostShape["settings"] = {286 const hostSettings: ProviderHost.ProviderHost["Service"]["settings"] = {
287 get: Ref.get(serverSettingsRef),287 get: Ref.get(serverSettingsRef),
288 changes: Stream.empty,288 changes: Stream.empty,
289 subscribe: PubSub.subscribe(serverSettingsChanges).pipe(289 subscribe: PubSub.subscribe(serverSettingsChanges).pipe(
packages/provider-core/src/server/snapshotSettings.ts+1-1
...@@ -29,7 +29,7 @@ export function haveProviderSnapshotSettingsChanged<Settings>(...@@ -29,7 +29,7 @@ export function haveProviderSnapshotSettingsChanged<Settings>(
2929
30export function makeProviderSnapshotSettingsSource<Settings>(30export function makeProviderSnapshotSettingsSource<Settings>(
31 provider: Settings,31 provider: Settings,
32 settings: ProviderHost.ProviderHostShape["settings"],32 settings: ProviderHost.ProviderHost["Service"]["settings"],
33): {33): {
34 readonly getSettings: Effect.Effect<ProviderSnapshotSettings<Settings>, ServerSettingsError>;34 readonly getSettings: Effect.Effect<ProviderSnapshotSettings<Settings>, ServerSettingsError>;
35 readonly streamSettings: Stream.Stream<ProviderSnapshotSettings<Settings>>;35 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";...@@ -22,7 +22,6 @@ import * as Path from "effect/Path";
22import * as Schema from "effect/Schema";22import * as Schema from "effect/Schema";
23import * as Stream from "effect/Stream";23import * as Stream from "effect/Stream";
2424
25import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
26import { layerTestProviderHost } from "@t3tools/provider-testing/host";25import { layerTestProviderHost } from "@t3tools/provider-testing/host";
27import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";26import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
28import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";27import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
...@@ -51,7 +50,6 @@ describe("CursorAdapterV2", () => {...@@ -51,7 +50,6 @@ describe("CursorAdapterV2", () => {
51 ({ status, model, lateModel }) =>50 ({ status, model, lateModel }) =>
52 Effect.gen(function* () {51 Effect.gen(function* () {
53 const fileSystem = yield* FileSystem.FileSystem;52 const fileSystem = yield* FileSystem.FileSystem;
54 const path = yield* Path.Path;
55 const workspace = yield* fileSystem.makeTempDirectoryScoped({53 const workspace = yield* fileSystem.makeTempDirectoryScoped({
56 prefix: "cursor-v2-lifecycle-",54 prefix: "cursor-v2-lifecycle-",
57 });55 });
...@@ -63,17 +61,12 @@ describe("CursorAdapterV2", () => {...@@ -63,17 +61,12 @@ describe("CursorAdapterV2", () => {
63 interactionMode: "default",61 interactionMode: "default",
64 cwd: workspace,62 cwd: workspace,
65 });63 });
66 const adapter = makeCursorAdapterV2({64 const adapter = yield* makeCursorAdapterV2({
67 instanceId,65 instanceId,
68 settings: yield* decodeCursorSettings({}),66 settings: yield* decodeCursorSettings({}),
69 environment: { HOME: workspace },67 environment: { HOME: workspace },
70 fileSystem,68 }).pipe(
71 path,69 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
72 idAllocator: yield* IdAllocator.IdAllocatorV2,
73 host: yield* ProviderHost.ProviderHost.pipe(
74 Effect.provide(layerTestProviderHost({ cwd: workspace })),
75 ),
76 runner: {
77 assertComplete: Effect.void,70 assertComplete: Effect.void,
78 open: () =>71 open: () =>
79 Effect.succeed({72 Effect.succeed({
...@@ -131,8 +124,9 @@ describe("CursorAdapterV2", () => {...@@ -131,8 +124,9 @@ describe("CursorAdapterV2", () => {
131 };124 };
132 }),125 }),
133 }),126 }),
134 },127 }),
135 });128 Effect.provide(layerTestProviderHost({ cwd: workspace })),
129 );
136 const runtime = yield* adapter.openSession({130 const runtime = yield* adapter.openSession({
137 threadId,131 threadId,
138 providerSessionId: ProviderSessionId.make("cursor-lifecycle-session"),132 providerSessionId: ProviderSessionId.make("cursor-lifecycle-session"),
...@@ -211,7 +205,6 @@ describe("CursorAdapterV2", () => {...@@ -211,7 +205,6 @@ describe("CursorAdapterV2", () => {
211 it.effect("fails standalone SDK transport diagnostics and sends compaction as /compress", () =>205 it.effect("fails standalone SDK transport diagnostics and sends compaction as /compress", () =>
212 Effect.gen(function* () {206 Effect.gen(function* () {
213 const fileSystem = yield* FileSystem.FileSystem;207 const fileSystem = yield* FileSystem.FileSystem;
214 const path = yield* Path.Path;
215 const workspace = yield* fileSystem.makeTempDirectoryScoped({ prefix: "cursor-v2-errors-" });208 const workspace = yield* fileSystem.makeTempDirectoryScoped({ prefix: "cursor-v2-errors-" });
216 const sentMessages: Array<string> = [];209 const sentMessages: Array<string> = [];
217 let sendCalls = 0;210 let sendCalls = 0;
...@@ -223,17 +216,12 @@ describe("CursorAdapterV2", () => {...@@ -223,17 +216,12 @@ describe("CursorAdapterV2", () => {
223 interactionMode: "default",216 interactionMode: "default",
224 cwd: workspace,217 cwd: workspace,
225 });218 });
226 const adapter = makeCursorAdapterV2({219 const adapter = yield* makeCursorAdapterV2({
227 instanceId,220 instanceId,
228 settings: yield* decodeCursorSettings({}),221 settings: yield* decodeCursorSettings({}),
229 environment: { HOME: workspace },222 environment: { HOME: workspace },
230 fileSystem,223 }).pipe(
231 path,224 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
232 idAllocator: yield* IdAllocator.IdAllocatorV2,
233 host: yield* ProviderHost.ProviderHost.pipe(
234 Effect.provide(layerTestProviderHost({ cwd: workspace })),
235 ),
236 runner: {
237 assertComplete: Effect.void,225 assertComplete: Effect.void,
238 open: () =>226 open: () =>
239 Effect.succeed({227 Effect.succeed({
...@@ -264,8 +252,9 @@ describe("CursorAdapterV2", () => {...@@ -264,8 +252,9 @@ describe("CursorAdapterV2", () => {
264 };252 };
265 }),253 }),
266 }),254 }),
267 },255 }),
268 });256 Effect.provide(layerTestProviderHost({ cwd: workspace })),
257 );
269 const runtime = yield* adapter.openSession({258 const runtime = yield* adapter.openSession({
270 threadId,259 threadId,
271 providerSessionId: ProviderSessionId.make("cursor-error-session"),260 providerSessionId: ProviderSessionId.make("cursor-error-session"),
...@@ -564,17 +553,12 @@ describe("CursorAdapterV2", () => {...@@ -564,17 +553,12 @@ describe("CursorAdapterV2", () => {
564 },553 },
565 },554 },
566 ];555 ];
567 const adapter = makeCursorAdapterV2({556 const adapter = yield* makeCursorAdapterV2({
568 instanceId,557 instanceId,
569 settings: yield* decodeCursorSettings({}),558 settings: yield* decodeCursorSettings({}),
570 environment: { HOME: workspace },559 environment: { HOME: workspace },
571 fileSystem,560 }).pipe(
572 path,561 Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, {
573 idAllocator: yield* IdAllocator.IdAllocatorV2,
574 host: yield* ProviderHost.ProviderHost.pipe(
575 Effect.provide(layerTestProviderHost({ cwd: workspace })),
576 ),
577 runner: {
578 assertComplete: Effect.void,562 assertComplete: Effect.void,
579 open: () =>563 open: () =>
580 Effect.succeed({564 Effect.succeed({
...@@ -602,8 +586,9 @@ describe("CursorAdapterV2", () => {...@@ -602,8 +586,9 @@ describe("CursorAdapterV2", () => {
602 };586 };
603 }),587 }),
604 }),588 }),
605 },589 }),
606 });590 Effect.provide(layerTestProviderHost({ cwd: workspace })),
591 );
607 const runtime = yield* adapter.openSession({592 const runtime = yield* adapter.openSession({
608 threadId,593 threadId,
609 providerSessionId: ProviderSessionId.make("cursor-search-session"),594 providerSessionId: ProviderSessionId.make("cursor-search-session"),
packages/provider-cursor/src/server/adapter.ts+12-32
...@@ -844,17 +844,17 @@ export interface CursorAdapterV2Options {...@@ -844,17 +844,17 @@ export interface CursorAdapterV2Options {
844 readonly instanceId: ProviderInstanceId;844 readonly instanceId: ProviderInstanceId;
845 readonly settings: CursorSettings;845 readonly settings: CursorSettings;
846 readonly environment: NodeJS.ProcessEnv;846 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;
852}847}
853848
854export function makeCursorAdapterV2(849export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
855 adapterOptions: CursorAdapterV2Options,850 options: CursorAdapterV2Options,
856): ProviderAdapter.ProviderAdapterV2Shape {851) {
857 const { fileSystem, path, idAllocator, runner, host } = adapterOptions;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;
858 const apiKey = adapterOptions.environment.CURSOR_API_KEY?.trim() || undefined;858 const apiKey = adapterOptions.environment.CURSOR_API_KEY?.trim() || undefined;
859859
860 return ProviderAdapter.ProviderAdapterV2.of({860 return ProviderAdapter.ProviderAdapterV2.of({
...@@ -2596,7 +2596,7 @@ export function makeCursorAdapterV2(...@@ -2596,7 +2596,7 @@ export function makeCursorAdapterV2(
2596 ),2596 ),
2597 ),2597 ),
2598 });2598 });
2599}2599});
26002600
2601export type CursorAdapterV2DriverEnv =2601export type CursorAdapterV2DriverEnv =
2602 | CursorAgentSdk.CursorAgentSdkRunner2602 | CursorAgentSdk.CursorAgentSdkRunner
...@@ -2615,23 +2615,13 @@ export const CursorAdapterV2Driver: ProviderAdapterDriver<...@@ -2615,23 +2615,13 @@ export const CursorAdapterV2Driver: ProviderAdapterDriver<
2615 create: Effect.fn("CursorAdapterV2Driver.create")(2615 create: Effect.fn("CursorAdapterV2Driver.create")(
2616 function* (input: ProviderAdapterDriverCreateInput<CursorSettings>) {2616 function* (input: ProviderAdapterDriverCreateInput<CursorSettings>) {
2617 const hostEnvironment = yield* HostProcessEnvironment;2617 const hostEnvironment = yield* HostProcessEnvironment;
2618 const fileSystem = yield* FileSystem.FileSystem;2618 return yield* makeCursorAdapterV2({
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({
2624 instanceId: input.instanceId,2619 instanceId: input.instanceId,
2625 settings: {2620 settings: {
2626 ...input.config,2621 ...input.config,
2627 enabled: input.enabled,2622 enabled: input.enabled,
2628 },2623 },
2629 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),2624 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
2630 fileSystem,
2631 path,
2632 idAllocator,
2633 runner,
2634 host,
2635 });2625 });
2636 },2626 },
2637 (effect, input) =>2627 (effect, input) =>
...@@ -2661,20 +2651,10 @@ const layer: Layer.Layer<...@@ -2661,20 +2651,10 @@ const layer: Layer.Layer<
2661 ProviderAdapter.ProviderAdapterV2,2651 ProviderAdapter.ProviderAdapterV2,
2662 Effect.gen(function* () {2652 Effect.gen(function* () {
2663 const hostEnvironment = yield* HostProcessEnvironment;2653 const hostEnvironment = yield* HostProcessEnvironment;
2664 const fileSystem = yield* FileSystem.FileSystem;2654 return yield* makeCursorAdapterV2({
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({
2670 instanceId: CURSOR_DEFAULT_INSTANCE_ID,2655 instanceId: CURSOR_DEFAULT_INSTANCE_ID,
2671 settings: DEFAULT_CURSOR_SETTINGS,2656 settings: DEFAULT_CURSOR_SETTINGS,
2672 environment: hostEnvironment,2657 environment: hostEnvironment,
2673 fileSystem,
2674 path,
2675 idAllocator,
2676 runner,
2677 host,
2678 });2658 });
2679 }),2659 }),
2680);2660);
packages/provider-cursor/src/server/credentialStore.test.ts-1
...@@ -4,7 +4,6 @@ import { ProviderInstanceId } from "@t3tools/contracts";...@@ -4,7 +4,6 @@ import { ProviderInstanceId } from "@t3tools/contracts";
4import * as Effect from "effect/Effect";4import * as Effect from "effect/Effect";
5import * as FileSystem from "effect/FileSystem";5import * as FileSystem from "effect/FileSystem";
6import * as Path from "effect/Path";6import * as Path from "effect/Path";
7import * as Option from "effect/Option";
87
9import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";8import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
10import { layerTestProviderHost } from "@t3tools/provider-testing/host";9import { layerTestProviderHost } from "@t3tools/provider-testing/host";
packages/provider-grok/src/server/adapter.ts+15-36
...@@ -112,12 +112,7 @@ export interface GrokAdapterV2Options {...@@ -112,12 +112,7 @@ export interface GrokAdapterV2Options {
112 readonly settings: GrokSettings;112 readonly settings: GrokSettings;
113 readonly environment: NodeJS.ProcessEnv;113 readonly environment: NodeJS.ProcessEnv;
114 readonly hostPlatform: NodeJS.Platform;114 readonly hostPlatform: NodeJS.Platform;
115 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
116 readonly crypto: Crypto.Crypto;
117 readonly selfInvocation: SelfInvocation;115 readonly selfInvocation: SelfInvocation;
118 readonly fileSystem: FileSystem.FileSystem;
119 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
120 readonly host: ProviderHost.ProviderHostShape;
121 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];116 readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"];
122 readonly continuationRequests?: Parameters<typeof makeAcpAdapterV2>[0]["continuationRequests"];117 readonly continuationRequests?: Parameters<typeof makeAcpAdapterV2>[0]["continuationRequests"];
123 readonly testHooks?: Parameters<typeof makeAcpAdapterV2>[0]["testHooks"];118 readonly testHooks?: Parameters<typeof makeAcpAdapterV2>[0]["testHooks"];
...@@ -229,7 +224,12 @@ export function grokLaunchRuntimeMode(...@@ -229,7 +224,12 @@ export function grokLaunchRuntimeMode(
229 : "approval-required";224 : "approval-required";
230}225}
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 {
233 return {233 return {
234 driver: GROK_PROVIDER,234 driver: GROK_PROVIDER,
235 runtimeHarness: "Grok",235 runtimeHarness: "Grok",
...@@ -329,15 +329,14 @@ export function makeGrokAcpAdapterFlavor(options: GrokAdapterV2Options): AcpAdap...@@ -329,15 +329,14 @@ export function makeGrokAcpAdapterFlavor(options: GrokAdapterV2Options): AcpAdap
329 };329 };
330}330}
331331
332export function makeGrokAdapterV2(options: GrokAdapterV2Options) {332export const makeGrokAdapterV2 = Effect.fn("makeGrokAdapterV2")(function* (
333 const flavor = makeGrokAcpAdapterFlavor(options);333 options: GrokAdapterV2Options,
334 return makeAcpAdapterV2({334) {
335 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
336 const flavor = makeGrokAcpAdapterFlavor({ ...options, childProcessSpawner });
337 return yield* makeAcpAdapterV2({
335 instanceId: options.instanceId,338 instanceId: options.instanceId,
336 flavor,339 flavor,
337 crypto: options.crypto,
338 fileSystem: options.fileSystem,
339 idAllocator: options.idAllocator,
340 host: options.host,
341 selfInvocation: options.selfInvocation,340 selfInvocation: options.selfInvocation,
342 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),341 ...(options.nativeLogging === undefined ? {} : { nativeLogging: options.nativeLogging }),
343 ...(options.continuationRequests === undefined342 ...(options.continuationRequests === undefined
...@@ -345,7 +344,7 @@ export function makeGrokAdapterV2(options: GrokAdapterV2Options) {...@@ -345,7 +344,7 @@ export function makeGrokAdapterV2(options: GrokAdapterV2Options) {
345 : { continuationRequests: options.continuationRequests }),344 : { continuationRequests: options.continuationRequests }),
346 ...(options.testHooks === undefined ? {} : { testHooks: options.testHooks }),345 ...(options.testHooks === undefined ? {} : { testHooks: options.testHooks }),
347 });346 });
348}347});
349348
350export type GrokAdapterV2DriverEnv =349export type GrokAdapterV2DriverEnv =
351 | ChildProcessSpawner.ChildProcessSpawner350 | ChildProcessSpawner.ChildProcessSpawner
...@@ -365,24 +364,14 @@ export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapte...@@ -365,24 +364,14 @@ export const GrokAdapterV2Driver: ProviderAdapterDriver<GrokSettings, GrokAdapte
365 const hostEnvironment = yield* HostProcessEnvironment;364 const hostEnvironment = yield* HostProcessEnvironment;
366 const hostPlatform = yield* HostProcessPlatform;365 const hostPlatform = yield* HostProcessPlatform;
367 const selfInvocation = yield* resolveSelfInvocation();366 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;
372 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;367 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
373 const host = yield* ProviderHost.ProviderHost;
374 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;368 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
375 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();369 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
376 return makeGrokAdapterV2({370 return yield* makeGrokAdapterV2({
377 instanceId: input.instanceId,371 instanceId: input.instanceId,
378 settings: { ...input.config, enabled: input.enabled },372 settings: { ...input.config, enabled: input.enabled },
379 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),373 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
380 hostPlatform,374 hostPlatform,
381 childProcessSpawner,
382 crypto,
383 fileSystem,
384 idAllocator,
385 host,
386 selfInvocation,375 selfInvocation,
387 continuationRequests,376 continuationRequests,
388 nativeLogging: (threadId) =>377 nativeLogging: (threadId) =>
...@@ -424,24 +413,14 @@ const layer: Layer.Layer<...@@ -424,24 +413,14 @@ const layer: Layer.Layer<
424 const hostEnvironment = yield* HostProcessEnvironment;413 const hostEnvironment = yield* HostProcessEnvironment;
425 const hostPlatform = yield* HostProcessPlatform;414 const hostPlatform = yield* HostProcessPlatform;
426 const selfInvocation = yield* resolveSelfInvocation();415 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;
431 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;416 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
432 const host = yield* ProviderHost.ProviderHost;
433 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;417 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
434 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();418 const makeNativeLogger = yield* makeAcpNativeLoggerFactory();
435 return makeGrokAdapterV2({419 return yield* makeGrokAdapterV2({
436 instanceId: GROK_DEFAULT_INSTANCE_ID,420 instanceId: GROK_DEFAULT_INSTANCE_ID,
437 settings: DEFAULT_GROK_SETTINGS,421 settings: DEFAULT_GROK_SETTINGS,
438 environment: hostEnvironment,422 environment: hostEnvironment,
439 hostPlatform,423 hostPlatform,
440 childProcessSpawner,
441 crypto,
442 fileSystem,
443 idAllocator,
444 host,
445 selfInvocation,424 selfInvocation,
446 continuationRequests,425 continuationRequests,
447 nativeLogging: (threadId) =>426 nativeLogging: (threadId) =>
packages/provider-muse/src/server/adapter.test.ts+2-10
...@@ -24,14 +24,12 @@ import * as Deferred from "effect/Deferred";...@@ -24,14 +24,12 @@ import * as Deferred from "effect/Deferred";
24import * as Effect from "effect/Effect";24import * as Effect from "effect/Effect";
25import * as Option from "effect/Option";25import * as Option from "effect/Option";
26import type * as Exit from "effect/Exit";26import type * as Exit from "effect/Exit";
27import * as FileSystem from "effect/FileSystem";
28import * as Fiber from "effect/Fiber";27import * as Fiber from "effect/Fiber";
29import * as Layer from "effect/Layer";28import * as Layer from "effect/Layer";
30import * as Queue from "effect/Queue";29import * as Queue from "effect/Queue";
31import * as Schema from "effect/Schema";30import * as Schema from "effect/Schema";
32import * as Stream from "effect/Stream";31import * as Stream from "effect/Stream";
3332
34import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
35import { layerTestProviderHost } from "@t3tools/provider-testing/host";33import { layerTestProviderHost } from "@t3tools/provider-testing/host";
36import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";34import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
37import type { MuseItem } from "./protocol.ts";35import type { MuseItem } from "./protocol.ts";
...@@ -195,13 +193,10 @@ const makeHarness = Effect.fnUntraced(function* (...@@ -195,13 +193,10 @@ const makeHarness = Effect.fnUntraced(function* (
195 > = {},193 > = {},
196) {194) {
197 let hostCount = 0;195 let hostCount = 0;
198 const adapter = makeMuseAdapterV2({196 const adapter = yield* makeMuseAdapterV2({
199 instanceId,197 instanceId,
200 settings: museSettings,198 settings: museSettings,
201 environment: { PATH: "/fake/bin" },199 environment: { PATH: "/fake/bin" },
202 idAllocator: yield* IdAllocator.IdAllocatorV2,
203 host: yield* ProviderHost.ProviderHost,
204 fileSystem: yield* FileSystem.FileSystem,
205 createHost: async () => (hostCount++ === 0 ? fake.host : (replacement ?? fake).host),200 createHost: async () => (hostCount++ === 0 ? fake.host : (replacement ?? fake).host),
206 ...overrides,201 ...overrides,
207 });202 });
...@@ -434,13 +429,10 @@ describe("MuseAdapterV2", () => {...@@ -434,13 +429,10 @@ describe("MuseAdapterV2", () => {
434 for (const kind of ["sessionNotFound", "notFound"] as const) {429 for (const kind of ["sessionNotFound", "notFound"] as const) {
435 const fake = yield* makeFakeMuse();430 const fake = yield* makeFakeMuse();
436 const allocated = yield* preallocatedProviderThread();431 const allocated = yield* preallocatedProviderThread();
437 const adapter = makeMuseAdapterV2({432 const adapter = yield* makeMuseAdapterV2({
438 instanceId: INSTANCE_ID,433 instanceId: INSTANCE_ID,
439 settings: museSettings,434 settings: museSettings,
440 environment: { PATH: "/fake/bin" },435 environment: { PATH: "/fake/bin" },
441 idAllocator: yield* IdAllocator.IdAllocatorV2,
442 host: yield* ProviderHost.ProviderHost,
443 fileSystem: yield* FileSystem.FileSystem,
444 createHost: async () => fake.host,436 createHost: async () => fake.host,
445 });437 });
446 const runtime = yield* adapter.openSession({438 const runtime = yield* adapter.openSession({
packages/provider-muse/src/server/adapter.ts+13-13
...@@ -35,7 +35,7 @@ import * as Semaphore from "effect/Semaphore";...@@ -35,7 +35,7 @@ import * as Semaphore from "effect/Semaphore";
35import * as Scope from "effect/Scope";35import * as Scope from "effect/Scope";
36import * as Stream from "effect/Stream";36import * 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";
39import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";39import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
40import { buildRuntimeInstructions } from "@t3tools/provider-core/server/runtimeInstructions";40import { buildRuntimeInstructions } from "@t3tools/provider-core/server/runtimeInstructions";
41import { museModelCapabilities, resolveMuseReasoningEffort } from "./modelCatalog.ts";41import { museModelCapabilities, resolveMuseReasoningEffort } from "./modelCatalog.ts";
...@@ -181,9 +181,6 @@ export interface MuseAdapterV2Options {...@@ -181,9 +181,6 @@ export interface MuseAdapterV2Options {
181 readonly instanceId: ProviderInstanceId;181 readonly instanceId: ProviderInstanceId;
182 readonly settings: MuseSettings;182 readonly settings: MuseSettings;
183 readonly environment: NodeJS.ProcessEnv;183 readonly environment: NodeJS.ProcessEnv;
184 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];
185 readonly host: ProviderHost.ProviderHostShape;
186 readonly fileSystem: FileSystem.FileSystem;
187 readonly modelCatalog?: Effect.Effect<ReadonlyArray<ServerProviderModel>>;184 readonly modelCatalog?: Effect.Effect<ReadonlyArray<ServerProviderModel>>;
188 readonly createHost?: typeof createMuseSdkHost;185 readonly createHost?: typeof createMuseSdkHost;
189 readonly requestTimeoutMs?: number;186 readonly requestTimeoutMs?: number;
...@@ -245,10 +242,13 @@ const TOOLS_WITH_NATIVE_ROWS = new Set(["write_todos", "request_user_input", "wo...@@ -245,10 +242,13 @@ const TOOLS_WITH_NATIVE_ROWS = new Set(["write_todos", "request_user_input", "wo
245const responseAnswerSchema = Schema.Union([Schema.String, Schema.Array(Schema.String)]);242const responseAnswerSchema = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
246243
247/** One scoped Muse host owns one native session; the orchestrator owns app runs and queuing. */244/** 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* (
249 options: MuseAdapterV2Options,246 options: MuseAdapterV2Options,
250): ProviderAdapter.ProviderAdapterV2Shape {247) {
251 const { idAllocator } = options;248 const idAllocator = yield* IdAllocator.IdAllocatorV2;
249 const providerHost = yield* ProviderHost.ProviderHost;
250 const fileSystem = yield* FileSystem.FileSystem;
251
252 const protocolError = (detail: string, payload?: unknown) =>252 const protocolError = (detail: string, payload?: unknown) =>
253 new ProviderAdapter.ProviderAdapterProtocolError({253 new ProviderAdapter.ProviderAdapterProtocolError({
254 driver: MUSE_PROVIDER,254 driver: MUSE_PROVIDER,
...@@ -269,8 +269,8 @@ export function makeMuseAdapterV2(...@@ -269,8 +269,8 @@ export function makeMuseAdapterV2(
269 const scope = yield* Effect.scope;269 const scope = yield* Effect.scope;
270 // Muse rejects non-canonical workspace roots (for example macOS /tmp) and270 // Muse rejects non-canonical workspace roots (for example macOS /tmp) and
271 // reports canonical paths in approvals, so resolve symlinks once here.271 // reports canonical paths in approvals, so resolve symlinks once here.
272 const requestedCwd = input.runtimePolicy.cwd ?? options.host.paths.cwd;272 const requestedCwd = input.runtimePolicy.cwd ?? providerHost.paths.cwd;
273 const cwd = yield* options.fileSystem273 const cwd = yield* fileSystem
274 .realPath(requestedCwd)274 .realPath(requestedCwd)
275 .pipe(Effect.orElseSucceed(() => requestedCwd));275 .pipe(Effect.orElseSucceed(() => requestedCwd));
276 const now = yield* DateTime.now;276 const now = yield* DateTime.now;
...@@ -1581,14 +1581,14 @@ export function makeMuseAdapterV2(...@@ -1581,14 +1581,14 @@ export function makeMuseAdapterV2(
1581 const text = providerMessageTextWithAttachmentPaths({1581 const text = providerMessageTextWithAttachmentPaths({
1582 text: message.text,1582 text: message.text,
1583 attachments: message.attachments,1583 attachments: message.attachments,
1584 resolveAttachmentPath: options.host.resolveAttachmentPath,1584 resolveAttachmentPath: providerHost.resolveAttachmentPath,
1585 });1585 });
1586 if (text) parts.push({ type: "text", text });1586 if (text) parts.push({ type: "text", text });
1587 for (const attachment of message.attachments)1587 for (const attachment of message.attachments)
1588 if (isProviderNativeImageAttachment(attachment)) {1588 if (isProviderNativeImageAttachment(attachment)) {
1589 const path = options.host.resolveAttachmentPath(attachment);1589 const path = providerHost.resolveAttachmentPath(attachment);
1590 if (!path) return yield* protocolError("Muse image attachment is missing");1590 if (!path) return yield* protocolError("Muse image attachment is missing");
1591 const bytes = yield* options.fileSystem1591 const bytes = yield* fileSystem
1592 .readFile(path)1592 .readFile(path)
1593 .pipe(Effect.mapError((cause) => protocolError("Cannot read Muse image", cause)));1593 .pipe(Effect.mapError((cause) => protocolError("Cannot read Muse image", cause)));
1594 parts.push({1594 parts.push({
...@@ -2031,4 +2031,4 @@ export function makeMuseAdapterV2(...@@ -2031,4 +2031,4 @@ export function makeMuseAdapterV2(
2031 return runtime;2031 return runtime;
2032 }),2032 }),
2033 });2033 });
2034}2034});
packages/provider-muse/src/server/driver.ts+1-5
...@@ -63,7 +63,6 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = {...@@ -63,7 +63,6 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = {
63 const host = yield* ProviderHost.ProviderHost;63 const host = yield* ProviderHost.ProviderHost;
64 const eventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;64 const eventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
65 const { cwd } = host.paths;65 const { cwd } = host.paths;
66 const idAllocator = yield* IdAllocator.IdAllocatorV2;
67 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;66 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
68 const hostEnvironment = yield* HostProcessEnvironment;67 const hostEnvironment = yield* HostProcessEnvironment;
69 // Drop an inherited META_API_KEY so Muse uses its login; an instance value still wins.68 // 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> = {...@@ -148,13 +147,10 @@ export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = {
148 ),147 ),
149 );148 );
150 const modelCatalog = snapshot.getSnapshot.pipe(Effect.map((current) => current.models));149 const modelCatalog = snapshot.getSnapshot.pipe(Effect.map((current) => current.models));
151 const orchestrationAdapter = makeMuseAdapterV2({150 const orchestrationAdapter = yield* makeMuseAdapterV2({
152 instanceId,151 instanceId,
153 settings: effectiveConfig,152 settings: effectiveConfig,
154 environment: processEnvironment,153 environment: processEnvironment,
155 idAllocator,
156 host,
157 fileSystem,
158 modelCatalog,154 modelCatalog,
159 ...(eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}),155 ...(eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}),
160 continuationRequests,156 continuationRequests,
packages/provider-opencode/src/server/adapter.test.ts+24-32
...@@ -34,7 +34,7 @@ import * as TestClock from "effect/testing/TestClock";...@@ -34,7 +34,7 @@ import * as TestClock from "effect/testing/TestClock";
34import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";34import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
35import { layerTestProviderHost } from "@t3tools/provider-testing/host";35import { layerTestProviderHost } from "@t3tools/provider-testing/host";
36import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";36import type * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
37import type * as OpenCodeRuntime from "./OpenCodeRuntime.ts";37import * as OpenCodeRuntime from "./OpenCodeRuntime.ts";
38import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";38import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
3939
40import {40import {
...@@ -148,7 +148,6 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct...@@ -148,7 +148,6 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
148 nativeSessionId: string,148 nativeSessionId: string,
149 client: object,149 client: object,
150) {150) {
151 const idAllocator = yield* IdAllocator.IdAllocatorV2;
152 const instanceId = ProviderInstanceId.make(`opencode-${suffix}`);151 const instanceId = ProviderInstanceId.make(`opencode-${suffix}`);
153 const threadId = ThreadId.make(`thread-opencode-${suffix}`);152 const threadId = ThreadId.make(`thread-opencode-${suffix}`);
154 const modelSelection = {153 const modelSelection = {
...@@ -157,20 +156,20 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct...@@ -157,20 +156,20 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
157 options: [],156 options: [],
158 };157 };
159 const policy = runtimePolicy("full-access", { cwd: "/workspace" });158 const policy = runtimePolicy("full-access", { cwd: "/workspace" });
160 const adapter = makeOpenCodeAdapterV2({159 const adapter = yield* makeOpenCodeAdapterV2({
161 instanceId,160 instanceId,
162 settings: OPEN_CODE_TEST_SETTINGS,161 settings: OPEN_CODE_TEST_SETTINGS,
163 environment: {},162 environment: {},
164 runtime: {163 }).pipe(
164 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
165 connectToOpenCodeServer: () => Effect.succeed({ url: "http://test.invalid", external: true }),165 connectToOpenCodeServer: () => Effect.succeed({ url: "http://test.invalid", external: true }),
166 createOpenCodeSdkClient: () => client,166 createOpenCodeSdkClient: () => client,
167 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,167 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
168 idAllocator,168 Effect.provideService(ProviderHost.ProviderHost, {
169 host: {
170 paths: { cwd: "/workspace" },169 paths: { cwd: "/workspace" },
171 resolveAttachmentPath: () => null,170 resolveAttachmentPath: () => null,
172 } as unknown as ProviderHost.ProviderHostShape,171 } as unknown as ProviderHost.ProviderHost["Service"]),
173 });172 );
174 const runtime = yield* adapter.openSession({173 const runtime = yield* adapter.openSession({
175 threadId,174 threadId,
176 providerSessionId: ProviderSessionId.make(`session-opencode-${suffix}`),175 providerSessionId: ProviderSessionId.make(`session-opencode-${suffix}`),
...@@ -1421,7 +1420,6 @@ describe("OpenCodeAdapterV2", () => {...@@ -1421,7 +1420,6 @@ describe("OpenCodeAdapterV2", () => {
14211420
1422 it.effect("keeps a newly admitted prompt alive across stale idle and delayed busy evidence", () =>1421 it.effect("keeps a newly admitted prompt alive across stale idle and delayed busy evidence", () =>
1423 Effect.gen(function* () {1422 Effect.gen(function* () {
1424 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1425 const nativeEvents = asyncEventStream();1423 const nativeEvents = asyncEventStream();
1426 const prompt = promiseGate<void>();1424 const prompt = promiseGate<void>();
1427 const promptStarted = promiseGate<void>();1425 const promptStarted = promiseGate<void>();
...@@ -1488,21 +1486,21 @@ describe("OpenCodeAdapterV2", () => {...@@ -1488,21 +1486,21 @@ describe("OpenCodeAdapterV2", () => {
1488 },1486 },
1489 mcp: { add: async () => ({ data: true }) },1487 mcp: { add: async () => ({ data: true }) },
1490 };1488 };
1491 const adapter = makeOpenCodeAdapterV2({1489 const adapter = yield* makeOpenCodeAdapterV2({
1492 instanceId: ProviderInstanceId.make("opencode-test"),1490 instanceId: ProviderInstanceId.make("opencode-test"),
1493 settings: OPEN_CODE_TEST_SETTINGS,1491 settings: OPEN_CODE_TEST_SETTINGS,
1494 environment: {},1492 environment: {},
1495 runtime: {1493 }).pipe(
1494 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
1496 connectToOpenCodeServer: () =>1495 connectToOpenCodeServer: () =>
1497 Effect.succeed({ url: "http://test.invalid", external: true }),1496 Effect.succeed({ url: "http://test.invalid", external: true }),
1498 createOpenCodeSdkClient: () => client,1497 createOpenCodeSdkClient: () => client,
1499 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,1498 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
1500 idAllocator,1499 Effect.provideService(ProviderHost.ProviderHost, {
1501 host: {
1502 paths: { cwd: "/workspace" },1500 paths: { cwd: "/workspace" },
1503 resolveAttachmentPath: () => null,1501 resolveAttachmentPath: () => null,
1504 } as unknown as ProviderHost.ProviderHostShape,1502 } as unknown as ProviderHost.ProviderHost["Service"]),
1505 });1503 );
1506 const threadId = ThreadId.make("thread-opencode-admission-race");1504 const threadId = ThreadId.make("thread-opencode-admission-race");
1507 const providerSessionId = ProviderSessionId.make("session-opencode-admission-race");1505 const providerSessionId = ProviderSessionId.make("session-opencode-admission-race");
1508 const modelSelection = {1506 const modelSelection = {
...@@ -1739,7 +1737,6 @@ describe("OpenCodeAdapterV2", () => {...@@ -1739,7 +1737,6 @@ describe("OpenCodeAdapterV2", () => {
17391737
1740 it.effect("interrupts an initial prompt while its SDK request is pending", () =>1738 it.effect("interrupts an initial prompt while its SDK request is pending", () =>
1741 Effect.gen(function* () {1739 Effect.gen(function* () {
1742 const idAllocator = yield* IdAllocator.IdAllocatorV2;
1743 const nativeEvents = asyncEventStream();1740 const nativeEvents = asyncEventStream();
1744 const promptStarted = promiseGate<void>();1741 const promptStarted = promiseGate<void>();
1745 const abortCalled = promiseGate<void>();1742 const abortCalled = promiseGate<void>();
...@@ -1783,21 +1780,21 @@ describe("OpenCodeAdapterV2", () => {...@@ -1783,21 +1780,21 @@ describe("OpenCodeAdapterV2", () => {
1783 },1780 },
1784 mcp: { add: async () => ({ data: true }) },1781 mcp: { add: async () => ({ data: true }) },
1785 };1782 };
1786 const adapter = makeOpenCodeAdapterV2({1783 const adapter = yield* makeOpenCodeAdapterV2({
1787 instanceId: ProviderInstanceId.make("opencode-initial-stop-test"),1784 instanceId: ProviderInstanceId.make("opencode-initial-stop-test"),
1788 settings: OPEN_CODE_TEST_SETTINGS,1785 settings: OPEN_CODE_TEST_SETTINGS,
1789 environment: {},1786 environment: {},
1790 runtime: {1787 }).pipe(
1788 Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, {
1791 connectToOpenCodeServer: () =>1789 connectToOpenCodeServer: () =>
1792 Effect.succeed({ url: "http://test.invalid", external: true }),1790 Effect.succeed({ url: "http://test.invalid", external: true }),
1793 createOpenCodeSdkClient: () => client,1791 createOpenCodeSdkClient: () => client,
1794 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape,1792 } as unknown as OpenCodeRuntime.OpenCodeRuntimeShape),
1795 idAllocator,1793 Effect.provideService(ProviderHost.ProviderHost, {
1796 host: {
1797 paths: { cwd: "/workspace" },1794 paths: { cwd: "/workspace" },
1798 resolveAttachmentPath: () => null,1795 resolveAttachmentPath: () => null,
1799 } as unknown as ProviderHost.ProviderHostShape,1796 } as unknown as ProviderHost.ProviderHost["Service"]),
1800 });1797 );
1801 const threadId = ThreadId.make("thread-opencode-initial-stop");1798 const threadId = ThreadId.make("thread-opencode-initial-stop");
1802 const providerSessionId = ProviderSessionId.make("session-opencode-initial-stop");1799 const providerSessionId = ProviderSessionId.make("session-opencode-initial-stop");
1803 const modelSelection = {1800 const modelSelection = {
...@@ -2419,8 +2416,6 @@ describe("OpenCodeAdapterV2", () => {...@@ -2419,8 +2416,6 @@ describe("OpenCodeAdapterV2", () => {
24192416
2420 it.effect("adopts the handed-over provider thread identity on session create", () =>2417 it.effect("adopts the handed-over provider thread identity on session create", () =>
2421 Effect.gen(function* () {2418 Effect.gen(function* () {
2422 const idAllocator = yield* IdAllocator.IdAllocatorV2;
2423 const host = yield* ProviderHost.ProviderHost;
2424 let createCount = 0;2419 let createCount = 0;
2425 const createInputs: Array<unknown> = [];2420 const createInputs: Array<unknown> = [];
2426 const fakeClient = {2421 const fakeClient = {
...@@ -2467,14 +2462,11 @@ describe("OpenCodeAdapterV2", () => {...@@ -2467,14 +2462,11 @@ describe("OpenCodeAdapterV2", () => {
2467 const instanceId = ProviderInstanceId.make("opencode");2462 const instanceId = ProviderInstanceId.make("opencode");
2468 const threadId = ThreadId.make("thread-opencode-adopt");2463 const threadId = ThreadId.make("thread-opencode-adopt");
2469 const modelSelection = { instanceId, model: "default" };2464 const modelSelection = { instanceId, model: "default" };
2470 const adapter = makeOpenCodeAdapterV2({2465 const adapter = yield* makeOpenCodeAdapterV2({
2471 instanceId,2466 instanceId,
2472 settings: OPENCODE_TEST_SETTINGS,2467 settings: OPENCODE_TEST_SETTINGS,
2473 environment: {},2468 environment: {},
2474 runtime,2469 }).pipe(Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, runtime));
2475 idAllocator,
2476 host,
2477 });
2478 const session = yield* adapter.openSession({2470 const session = yield* adapter.openSession({
2479 threadId,2471 threadId,
2480 providerSessionId: ProviderSessionId.make("provider-session-opencode-adopt"),2472 providerSessionId: ProviderSessionId.make("provider-session-opencode-adopt"),
packages/provider-opencode/src/server/adapter.ts+8-21
...@@ -438,9 +438,6 @@ export interface OpenCodeAdapterV2Options {...@@ -438,9 +438,6 @@ export interface OpenCodeAdapterV2Options {
438 readonly instanceId: ProviderInstanceId;438 readonly instanceId: ProviderInstanceId;
439 readonly settings: OpenCodeSettings;439 readonly settings: OpenCodeSettings;
440 readonly environment: NodeJS.ProcessEnv;440 readonly environment: NodeJS.ProcessEnv;
441 readonly runtime: OpenCodeRuntime.OpenCodeRuntimeShape;
442 readonly idAllocator: IdAllocator.IdAllocatorV2Shape;
443 readonly host: ProviderHost.ProviderHostShape;
444 readonly nativeEventLogger?: ProviderEventLoggers.EventNdjsonLogger;441 readonly nativeEventLogger?: ProviderEventLoggers.EventNdjsonLogger;
445}442}
446443
...@@ -944,10 +941,12 @@ function unwrapData<A>(operation: string, result: { readonly data?: A }): NonNul...@@ -944,10 +941,12 @@ function unwrapData<A>(operation: string, result: { readonly data?: A }): NonNul
944 return result.data as NonNullable<A>;941 return result.data as NonNullable<A>;
945}942}
946943
947export function makeOpenCodeAdapterV2(944export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function* (
948 options: OpenCodeAdapterV2Options,945 options: OpenCodeAdapterV2Options,
949): ProviderAdapter.ProviderAdapterV2Shape {946) {
950 const { idAllocator, runtime, host } = options;947 const runtime = yield* OpenCodeRuntime.OpenCodeRuntime;
948 const idAllocator = yield* IdAllocator.IdAllocatorV2;
949 const host = yield* ProviderHost.ProviderHost;
951950
952 return ProviderAdapter.ProviderAdapterV2.of({951 return ProviderAdapter.ProviderAdapterV2.of({
953 instanceId: options.instanceId,952 instanceId: options.instanceId,
...@@ -3724,7 +3723,7 @@ export function makeOpenCodeAdapterV2(...@@ -3724,7 +3723,7 @@ export function makeOpenCodeAdapterV2(
3724 ),3723 ),
3725 ),3724 ),
3726 });3725 });
3727}3726});
37283727
3729export type OpenCodeAdapterV2DriverEnv =3728export type OpenCodeAdapterV2DriverEnv =
3730 | OpenCodeRuntime.OpenCodeRuntime3729 | OpenCodeRuntime.OpenCodeRuntime
...@@ -3742,17 +3741,11 @@ export const OpenCodeAdapterV2Driver: ProviderAdapterDriver<...@@ -3742,17 +3741,11 @@ export const OpenCodeAdapterV2Driver: ProviderAdapterDriver<
3742 create: Effect.fn("OpenCodeAdapterV2Driver.create")(3741 create: Effect.fn("OpenCodeAdapterV2Driver.create")(
3743 function* (input: ProviderAdapterDriverCreateInput<OpenCodeSettings>) {3742 function* (input: ProviderAdapterDriverCreateInput<OpenCodeSettings>) {
3744 const hostEnvironment = yield* HostProcessEnvironment;3743 const hostEnvironment = yield* HostProcessEnvironment;
3745 const openCodeRuntime = yield* OpenCodeRuntime.OpenCodeRuntime;
3746 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3747 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;3744 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
3748 const host = yield* ProviderHost.ProviderHost;3745 return yield* makeOpenCodeAdapterV2({
3749 return makeOpenCodeAdapterV2({
3750 instanceId: input.instanceId,3746 instanceId: input.instanceId,
3751 settings: { ...input.config, enabled: input.enabled },3747 settings: { ...input.config, enabled: input.enabled },
3752 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),3748 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
3753 runtime: openCodeRuntime,
3754 idAllocator,
3755 host,
3756 ...(providerEventLoggers.native === undefined3749 ...(providerEventLoggers.native === undefined
3757 ? {}3750 ? {}
3758 : { nativeEventLogger: providerEventLoggers.native }),3751 : { nativeEventLogger: providerEventLoggers.native }),
...@@ -3778,17 +3771,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, OpenCodeAdapt...@@ -3778,17 +3771,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, OpenCodeAdapt
3778 ProviderAdapter.ProviderAdapterV2,3771 ProviderAdapter.ProviderAdapterV2,
3779 Effect.gen(function* () {3772 Effect.gen(function* () {
3780 const hostEnvironment = yield* HostProcessEnvironment;3773 const hostEnvironment = yield* HostProcessEnvironment;
3781 const openCodeRuntime = yield* OpenCodeRuntime.OpenCodeRuntime;
3782 const idAllocator = yield* IdAllocator.IdAllocatorV2;
3783 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;3774 const providerEventLoggers = yield* ProviderEventLoggers.ProviderEventLoggers;
3784 const host = yield* ProviderHost.ProviderHost;3775 return yield* makeOpenCodeAdapterV2({
3785 return makeOpenCodeAdapterV2({
3786 instanceId: OPENCODE_DEFAULT_INSTANCE_ID,3776 instanceId: OPENCODE_DEFAULT_INSTANCE_ID,
3787 settings: DEFAULT_OPENCODE_SETTINGS,3777 settings: DEFAULT_OPENCODE_SETTINGS,
3788 environment: hostEnvironment,3778 environment: hostEnvironment,
3789 runtime: openCodeRuntime,
3790 idAllocator,
3791 host,
3792 ...(providerEventLoggers.native === undefined3779 ...(providerEventLoggers.native === undefined
3793 ? {}3780 ? {}
3794 : { nativeEventLogger: providerEventLoggers.native }),3781 : { nativeEventLogger: providerEventLoggers.native }),
packages/provider-opencode/src/server/v2/textGeneration.ts+1-1
...@@ -40,7 +40,7 @@ type Outcome =...@@ -40,7 +40,7 @@ type Outcome =
40const runOnServer = (40const runOnServer = (
41 connection: OpenCode2Server.OpenCode2Connection,41 connection: OpenCode2Server.OpenCode2Connection,
42 input: TextGenerationOperations.Request<Schema.Top>,42 input: TextGenerationOperations.Request<Schema.Top>,
43 resolveAttachmentPath: ProviderHost.ProviderHostShape["resolveAttachmentPath"],43 resolveAttachmentPath: ProviderHost.ProviderHost["Service"]["resolveAttachmentPath"],
44) =>44) =>
45 Effect.gen(function* () {45 Effect.gen(function* () {
46 const { client } = connection;46 const { client } = connection;
packages/provider-pi/src/server/adapter.test.ts+4-34
...@@ -22,7 +22,6 @@ import * as DateTime from "effect/DateTime";...@@ -22,7 +22,6 @@ import * as DateTime from "effect/DateTime";
22import * as Duration from "effect/Duration";22import * as Duration from "effect/Duration";
23import * as Effect from "effect/Effect";23import * as Effect from "effect/Effect";
24import * as Fiber from "effect/Fiber";24import * as Fiber from "effect/Fiber";
25import * as FileSystem from "effect/FileSystem";
26import * as Layer from "effect/Layer";25import * as Layer from "effect/Layer";
27import * as PlatformError from "effect/PlatformError";26import * as PlatformError from "effect/PlatformError";
28import * as Queue from "effect/Queue";27import * as Queue from "effect/Queue";
...@@ -31,21 +30,14 @@ import * as Sink from "effect/Sink";...@@ -31,21 +30,14 @@ import * as Sink from "effect/Sink";
31import * as Stream from "effect/Stream";30import * as Stream from "effect/Stream";
32import * as TestClock from "effect/testing/TestClock";31import * as TestClock from "effect/testing/TestClock";
33import { ChildProcess, ChildProcessSpawner } from "effect/process";32import { ChildProcess, ChildProcessSpawner } from "effect/process";
34import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
3533
36import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
37import { layerTestProviderHost } from "@t3tools/provider-testing/host";34import { layerTestProviderHost } from "@t3tools/provider-testing/host";
38import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";35import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
39import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";36import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
40import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";37import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
41import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";38import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
42import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";39import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";
43import {40import { makePiAdapterV2, PI_PROVIDER, type PiAdapterV2Options } from "./adapter.ts";
44 makePiAdapterV2,
45 PiAdapterV2Driver,
46 PI_PROVIDER,
47 type PiAdapterV2Options,
48} from "./adapter.ts";
49import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";41import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";
5042
51const layerTest = Layer.mergeAll(43const layerTest = Layer.mergeAll(
...@@ -326,9 +318,6 @@ const makeAdapter = Effect.fnUntraced(function* (...@@ -326,9 +318,6 @@ const makeAdapter = Effect.fnUntraced(function* (
326 forkFake?: FakePi,318 forkFake?: FakePi,
327 continuationRequests?: PiAdapterV2Options["continuationRequests"],319 continuationRequests?: PiAdapterV2Options["continuationRequests"],
328) {320) {
329 const idAllocator = yield* IdAllocator.IdAllocatorV2;
330 const host = yield* ProviderHost.ProviderHost;
331 const fileSystem = yield* FileSystem.FileSystem;
332 const spawner =321 const spawner =
333 forkFake === undefined322 forkFake === undefined
334 ? fake.spawner323 ? fake.spawner
...@@ -337,31 +326,12 @@ const makeAdapter = Effect.fnUntraced(function* (...@@ -337,31 +326,12 @@ const makeAdapter = Effect.fnUntraced(function* (
337 ? forkFake.spawner.spawn(command)326 ? forkFake.spawner.spawn(command)
338 : fake.spawner.spawn(command),327 : fake.spawner.spawn(command),
339 );328 );
340 if (continuationRequests !== undefined) {329 return yield* makePiAdapterV2({
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({
357 instanceId: PI_INSTANCE_ID,330 instanceId: PI_INSTANCE_ID,
358 settings: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },331 settings: { enabled: true, binaryPath: "pi", launchArgs, customModels: [] },
359 environment: {},332 environment: {},
360 spawner,333 ...(continuationRequests === undefined ? {} : { continuationRequests }),
361 fileSystem,334 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
362 idAllocator,
363 host,
364 });
365});335});
366336
367const openRuntime = Effect.fnUntraced(function* (337const openRuntime = Effect.fnUntraced(function* (
packages/provider-pi/src/server/adapter.ts+23-35
...@@ -228,10 +228,10 @@ export interface PiAdapterV2Options {...@@ -228,10 +228,10 @@ export interface PiAdapterV2Options {
228 readonly instanceId: ProviderInstanceId;228 readonly instanceId: ProviderInstanceId;
229 readonly settings: PiSettings;229 readonly settings: PiSettings;
230 readonly environment: NodeJS.ProcessEnv;230 readonly environment: NodeJS.ProcessEnv;
231 readonly spawner: ChildProcessSpawner.ChildProcessSpawner["Service"];231 /**
232 readonly fileSystem: FileSystem.FileSystem;232 * Where to offer a wake turn for provider-initiated work. Without one, such
233 readonly idAllocator: IdAllocator.IdAllocatorV2["Service"];233 * work has no owner and the adapter stops it.
234 readonly host: ProviderHost.ProviderHostShape;234 */
235 readonly continuationRequests?: {235 readonly continuationRequests?: {
236 readonly offer: (236 readonly offer: (
237 request: ProviderContinuationRequests.ProviderContinuationRequest,237 request: ProviderContinuationRequests.ProviderContinuationRequest,
...@@ -386,10 +386,14 @@ interface PiWake {...@@ -386,10 +386,14 @@ interface PiWake {
386386
387// ── adapter ───────────────────────────────────────────────────387// ── adapter ───────────────────────────────────────────────────
388388
389export function makePiAdapterV2(389export const makePiAdapterV2 = Effect.fn("makePiAdapterV2")(function* (
390 options: PiAdapterV2Options,390 options: PiAdapterV2Options,
391): ProviderAdapter.ProviderAdapterV2Shape {391) {
392 const { idAllocator } = options;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
394 const protocolError = (detail: string, payload?: unknown) =>398 const protocolError = (detail: string, payload?: unknown) =>
395 new ProviderAdapter.ProviderAdapterProtocolError({399 new ProviderAdapter.ProviderAdapterProtocolError({
...@@ -407,11 +411,11 @@ export function makePiAdapterV2(...@@ -407,11 +411,11 @@ export function makePiAdapterV2(
407 input: ProviderAdapter.ProviderAdapterV2OpenSessionInput,411 input: ProviderAdapter.ProviderAdapterV2OpenSessionInput,
408 ) {412 ) {
409 const scope = yield* Effect.scope;413 const scope = yield* Effect.scope;
410 const cwd = input.runtimePolicy.cwd ?? options.host.paths.cwd;414 const cwd = input.runtimePolicy.cwd ?? host.paths.cwd;
411 const mcpSession = McpProviderSession.readMcpProviderSession(input.threadId);415 const mcpSession = McpProviderSession.readMcpProviderSession(input.threadId);
412 const provideCacheFs = <A, E>(effect: Effect.Effect<A, E, FileSystem.FileSystem>) =>416 const provideCacheFs = <A, E>(effect: Effect.Effect<A, E, FileSystem.FileSystem>) =>
413 effect.pipe(417 effect.pipe(
414 Effect.provideService(FileSystem.FileSystem, options.fileSystem),418 Effect.provideService(FileSystem.FileSystem, fileSystem),
415 Effect.mapError(419 Effect.mapError(
416 (cause) =>420 (cause) =>
417 new ProviderAdapter.ProviderAdapterOpenSessionError({421 new ProviderAdapter.ProviderAdapterOpenSessionError({
...@@ -425,7 +429,7 @@ export function makePiAdapterV2(...@@ -425,7 +429,7 @@ export function makePiAdapterV2(
425 // hook. Materialize it even when this session has no MCP credential so429 // hook. Materialize it even when this session has no MCP credential so
426 // Supervised never silently degrades to unrestricted tool execution.430 // Supervised never silently degrades to unrestricted tool execution.
427 const extensionPath = yield* provideCacheFs(431 const extensionPath = yield* provideCacheFs(
428 materializePiT3McpExtension(options.host.paths.providerStatusCacheDir),432 materializePiT3McpExtension(host.paths.providerStatusCacheDir),
429 );433 );
430 const resolvedLaunchArgs = resolvePiLaunchArgs(options.settings.launchArgs);434 const resolvedLaunchArgs = resolvePiLaunchArgs(options.settings.launchArgs);
431 if (!resolvedLaunchArgs.ok) {435 if (!resolvedLaunchArgs.ok) {
...@@ -444,7 +448,7 @@ export function makePiAdapterV2(...@@ -444,7 +448,7 @@ export function makePiAdapterV2(
444 cwd,448 cwd,
445 env: launch.env,449 env: launch.env,
446 }).pipe(450 }).pipe(
447 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, options.spawner),451 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
448 Effect.mapError(452 Effect.mapError(
449 (cause) =>453 (cause) =>
450 new ProviderAdapter.ProviderAdapterOpenSessionError({454 new ProviderAdapter.ProviderAdapterOpenSessionError({
...@@ -1622,7 +1626,7 @@ export function makePiAdapterV2(...@@ -1622,7 +1626,7 @@ export function makePiAdapterV2(
1622 if (1626 if (
1623 turn === null &&1627 turn === null &&
1624 state?.providerThread.appThreadId != null &&1628 state?.providerThread.appThreadId != null &&
1625 options.continuationRequests !== undefined &&1629 continuationRequests !== undefined &&
1626 !closed &&1630 !closed &&
1627 !stopRequested1631 !stopRequested
1628 ) {1632 ) {
...@@ -1633,7 +1637,7 @@ export function makePiAdapterV2(...@@ -1633,7 +1637,7 @@ export function makePiAdapterV2(
1633 return;1637 return;
1634 }1638 }
1635 yield* updateProviderSession("running", null);1639 yield* updateProviderSession("running", null);
1636 yield* options.continuationRequests1640 yield* continuationRequests
1637 .offer({1641 .offer({
1638 threadId: state.providerThread.appThreadId,1642 threadId: state.providerThread.appThreadId,
1639 providerThreadId: state.providerThread.id,1643 providerThreadId: state.providerThread.id,
...@@ -2337,10 +2341,10 @@ export function makePiAdapterV2(...@@ -2337,10 +2341,10 @@ export function makePiAdapterV2(
2337 const images: Array<{ type: "image"; data: string; mimeType: string }> = [];2341 const images: Array<{ type: "image"; data: string; mimeType: string }> = [];
2338 const extraLines: Array<string> = [];2342 const extraLines: Array<string> = [];
2339 for (const attachment of attachments) {2343 for (const attachment of attachments) {
2340 const path = options.host.resolveAttachmentPath(attachment);2344 const path = host.resolveAttachmentPath(attachment);
2341 if (path === null) continue;2345 if (path === null) continue;
2342 if (attachment.mimeType.startsWith("image/")) {2346 if (attachment.mimeType.startsWith("image/")) {
2343 const bytes = yield* options.fileSystem.readFile(path);2347 const bytes = yield* fileSystem.readFile(path);
2344 images.push({2348 images.push({
2345 type: "image",2349 type: "image",
2346 data: Buffer.from(bytes).toString("base64"),2350 data: Buffer.from(bytes).toString("base64"),
...@@ -3033,7 +3037,7 @@ export function makePiAdapterV2(...@@ -3033,7 +3037,7 @@ export function makePiAdapterV2(
3033 }3037 }
3034 return file;3038 return file;
3035 }),3039 }),
3036 ).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, options.spawner));3040 ).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
3037 const now = yield* DateTime.now;3041 const now = yield* DateTime.now;
3038 return yield* registerThread(3042 return yield* registerThread(
3039 {3043 {
...@@ -3082,7 +3086,7 @@ export function makePiAdapterV2(...@@ -3082,7 +3086,7 @@ export function makePiAdapterV2(
3082 return runtime;3086 return runtime;
3083 }),3087 }),
3084 });3088 });
3085}3089});
30863090
3087/**3091/**
3088 * Resolve the pi session-tree entry `fork` should re-root at for a rollback.3092 * Resolve the pi session-tree entry `fork` should re-root at for a rollback.
...@@ -3210,19 +3214,11 @@ export const PiAdapterV2Driver: ProviderAdapterDriver<PiSettings, PiAdapterV2Dri...@@ -3210,19 +3214,11 @@ export const PiAdapterV2Driver: ProviderAdapterDriver<PiSettings, PiAdapterV2Dri
3210 create: Effect.fn("PiAdapterV2Driver.create")(3214 create: Effect.fn("PiAdapterV2Driver.create")(
3211 function* (input: ProviderAdapterDriverCreateInput<PiSettings>) {3215 function* (input: ProviderAdapterDriverCreateInput<PiSettings>) {
3212 const hostEnvironment = yield* HostProcessEnvironment;3216 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;
3217 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;3217 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
3218 return makePiAdapterV2({3218 return yield* makePiAdapterV2({
3219 instanceId: input.instanceId,3219 instanceId: input.instanceId,
3220 settings: { ...input.config, enabled: input.enabled },3220 settings: { ...input.config, enabled: input.enabled },
3221 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),3221 environment: mergeProviderInstanceEnvironment(input.environment, hostEnvironment),
3222 spawner,
3223 fileSystem,
3224 idAllocator,
3225 host,
3226 continuationRequests,3222 continuationRequests,
3227 });3223 });
3228 },3224 },
...@@ -3246,19 +3242,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, PiAdapterV2Dr...@@ -3246,19 +3242,11 @@ const layer: Layer.Layer<ProviderAdapter.ProviderAdapterV2, never, PiAdapterV2Dr
3246 ProviderAdapter.ProviderAdapterV2,3242 ProviderAdapter.ProviderAdapterV2,
3247 Effect.gen(function* () {3243 Effect.gen(function* () {
3248 const hostEnvironment = yield* HostProcessEnvironment;3244 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;
3253 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;3245 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
3254 return makePiAdapterV2({3246 return yield* makePiAdapterV2({
3255 instanceId: PI_DEFAULT_INSTANCE_ID,3247 instanceId: PI_DEFAULT_INSTANCE_ID,
3256 settings: DEFAULT_PI_SETTINGS,3248 settings: DEFAULT_PI_SETTINGS,
3257 environment: hostEnvironment,3249 environment: hostEnvironment,
3258 spawner,
3259 fileSystem,
3260 idAllocator,
3261 host,
3262 continuationRequests,3250 continuationRequests,
3263 });3251 });
3264 }),3252 }),