@devries-cameron20 / t3code-1 / commits / 43f8a8de17
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(provider-acp-registry): move the ACP Registry into its own package (#17405)

Julius Marminge committed Oct 8, 2026 at 23:08 UTC 43f8a8de17a7ac1baa7a3cf36d681856de2d8add
58 files changed +470 -299
apps/mobile/package.json
+1
@@ -69,6 +69,7 @@
69 "@t3tools/mobile-markdown-text": "file:./modules/t3-markdown-text",
70 "@t3tools/mobile-review-diff-native": "file:./modules/t3-review-diff",
71 "@t3tools/mobile-terminal-native": "file:./modules/t3-terminal",
72 + "@t3tools/provider-acp-registry": "workspace:*",
73 "@t3tools/provider-core": "workspace:*",
74 "@t3tools/provider-cursor": "workspace:*",
75 "@t3tools/provider-grok": "workspace:*",
apps/mobile/src/lib/providerClients.ts
+2
@@ -1,4 +1,5 @@
1 import { isProviderDriverKind } from "@t3tools/contracts";
2 +import { acpRegistryClient } from "@t3tools/provider-acp-registry/client";
3 import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
4 import { cursorClient } from "@t3tools/provider-cursor/client";
5 import { grokClient } from "@t3tools/provider-grok/client";
@@ -13,6 +14,7 @@ const providerClients = makeProviderClientRegistry([
14 museClient,
15 openCodeClient,
16 piClient,
17 + acpRegistryClient,
18 ]);
19
20 /** The client definition for a driver kind, or `undefined` for drivers drawn by hand. */
apps/server/package.json
+1 -1
@@ -36,9 +36,9 @@
36 "@ff-labs/fff-node": "0.9.4",
37 "@muse-code/sdk": "1.4.2",
38 "@napi-rs/keyring": "^1.3.0",
39 - "@noble/hashes": "catalog:",
39 "@opencode-ai/sdk": "^1.3.15",
40 "@t3tools/provider-acp": "workspace:*",
41 + "@t3tools/provider-acp-registry": "workspace:*",
42 "@t3tools/provider-core": "workspace:*",
43 "@t3tools/provider-cursor": "workspace:*",
44 "@t3tools/provider-grok": "workspace:*",
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+2 -2
@@ -2,7 +2,7 @@ import {
2 normalizeDevinSessionUpdate,
3 normalizeDevinToolCall,
4 extractDevinSubagentUpdate,
5 -} from "./DevinAcp.ts";
5 +} from "@t3tools/provider-acp-registry/testing";
6 // @effect-diagnostics nodeBuiltinImport:off
7 import * as NodeChildProcess from "node:child_process";
8 import * as NodeFS from "node:fs";
@@ -95,7 +95,7 @@ import { makeGrokAdapterV2 } from "@t3tools/provider-grok/testing";
95 import {
96 acpRegistryPromptFailure,
97 registerMistralVibeAcpExtensions,
98 -} from "./AcpRegistryAdapterV2.ts";
98 +} from "@t3tools/provider-acp-registry/testing";
99
100 const DEFAULT_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({});
101
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
+4 -4
@@ -19,8 +19,8 @@ import * as ServerSettings from "../../serverSettings.ts";
19 import type {
20 AcpRegistryAvailableCommands,
21 AcpRegistryLiveConfiguration,
22 -} from "../../provider/acp/AcpRegistryProbe.ts";
23 -import * as AcpRegistrySupport from "../../provider/acp/AcpRegistrySupport.ts";
22 +} from "@t3tools/provider-acp-registry/testing";
23 +import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
24 import { ACP_SESSION_MODE_OPTION_ID } from "@t3tools/provider-acp/server/sessionConfig";
25 import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
26 import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
@@ -31,12 +31,12 @@ import {
31 } from "./AcpAdapterV2.testkit.ts";
32 import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/ProviderAdapter";
33 import { BUILT_IN_PROVIDER_ADAPTER_DRIVER_KINDS_V2 } from "../builtInProviderAdapterDrivers.ts";
34 +import { AcpRegistryAdapterV2Driver } from "@t3tools/provider-acp-registry/server";
35 import {
36 ACP_REGISTRY_PROVIDER,
36 - AcpRegistryAdapterV2Driver,
37 makeAcpRegistryAdapterV2,
38 acpRegistryPromptFailure,
39 -} from "./AcpRegistryAdapterV2.ts";
39 +} from "@t3tools/provider-acp-registry/testing";
40
41 const registryUrl = "https://registry.test/registry.json";
42 const decodeAcpRegistryAdapterSettings = Schema.decodeUnknownEffect(
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.testkit.ts
+2 -2
@@ -1,5 +1,5 @@
1 import * as NodeServices from "@effect/platform-node/NodeServices";
2 -import { AcpRegistrySettings } from "@t3tools/contracts";
2 +import { AcpRegistrySettings } from "@t3tools/provider-acp-registry/settings";
3 import { resolveSelfInvocation } from "@t3tools/shared/nodeRuntime";
4 import * as Effect from "effect/Effect";
5 import * as FileSystem from "effect/FileSystem";
@@ -24,7 +24,7 @@ import {
24 ACP_REGISTRY_DEFAULT_INSTANCE_ID,
25 ACP_REGISTRY_PROVIDER,
26 makeAcpRegistryAdapterV2,
27 -} from "./AcpRegistryAdapterV2.ts";
27 +} from "@t3tools/provider-acp-registry/testing";
28
29 const REPLAY_SETTINGS = Schema.decodeUnknownSync(AcpRegistrySettings)({
30 agentId: "replay-agent",
apps/server/src/orchestration-v2/ProviderAdapterRegistry.test.ts
+1 -1
@@ -18,7 +18,7 @@ import * as Schema from "effect/Schema";
18 import type * as Scope from "effect/Scope";
19 import * as Stream from "effect/Stream";
20
21 -import * as ProviderAuthFlow from "../provider/ProviderAuthFlow.ts";
21 +import * as ProviderAuthFlow from "@t3tools/provider-core/server/ProviderAuthFlow";
22 import type { ProviderAuthController } from "../provider/ProviderAuthService.ts";
23 import type { ProviderInstance } from "@t3tools/provider-core/server/driver";
24 import * as ProviderInstanceRegistry from "../provider/ProviderInstanceRegistry.ts";
apps/server/src/orchestration-v2/builtInProviderAdapterDrivers.ts
+1 -1
@@ -3,7 +3,7 @@ import type { ProviderDriverKind } from "@t3tools/contracts";
3 import {
4 AcpRegistryAdapterV2Driver,
5 type AcpRegistryAdapterV2DriverEnv,
6 -} from "./Adapters/AcpRegistryAdapterV2.ts";
6 +} from "@t3tools/provider-acp-registry/server";
7 import {
8 ClaudeAdapterV2Driver,
9 type ClaudeAdapterV2DriverEnv,
apps/server/src/provider/AcpRegistryCatalog.ts deleted
-22
@@ -1,22 +0,0 @@
1 -import * as Effect from "effect/Effect";
2 -import * as Layer from "effect/Layer";
3 -import * as Path from "effect/Path";
4 -
5 -import * as ServerConfig from "../config.ts";
6 -import * as AcpRegistrySupport from "./acp/AcpRegistrySupport.ts";
7 -import * as AcpRegistryRuntimeCoordinator from "./acp/AcpRegistryRuntimeCoordinator.ts";
8 -
9 -/** Server-lifetime ACP Registry catalog shared by setup, snapshots, and turn launch. */
10 -export const layer = Layer.merge(
11 - Layer.unwrap(
12 - Effect.gen(function* () {
13 - const config = yield* ServerConfig.ServerConfig;
14 - const path = yield* Path.Path;
15 - return AcpRegistrySupport.AcpRegistryCatalog.layer({
16 - cacheDir: config.providerStatusCacheDir,
17 - toolsDir: path.join(config.baseDir, "tools"),
18 - });
19 - }),
20 - ),
21 - AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer,
22 -);
apps/server/src/provider/AcpRegistryProbe.test.ts renamed
+5 -4
@@ -3,7 +3,8 @@ import * as NodePath from "node:path";
3 import * as NodeURL from "node:url";
4
5 import * as NodeServices from "@effect/platform-node/NodeServices";
6 -import { AcpRegistrySettings, ProviderInstanceId } from "@t3tools/contracts";
6 +import { ProviderInstanceId } from "@t3tools/contracts";
7 +import { AcpRegistrySettings } from "@t3tools/provider-acp-registry/settings";
8 import { describe, expect, it } from "@effect/vitest";
9 import * as Deferred from "effect/Deferred";
10 import * as Effect from "effect/Effect";
@@ -21,12 +22,12 @@ import {
22 normalizeAcpRegistryAuthMethods,
23 normalizeAcpRegistryCommands,
24 probeAcpRegistryConfiguration,
24 -} from "./AcpRegistryProbe.ts";
25 -import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
25 +} from "@t3tools/provider-acp-registry/testing";
26 +import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
27
28 const instanceId = ProviderInstanceId.make("acpRegistry_codex");
29 const __dirname = NodePath.dirname(NodeURL.fileURLToPath(import.meta.url));
29 -const mockAgentPath = NodePath.join(__dirname, "../../../scripts/acp-mock-agent.ts");
30 +const mockAgentPath = NodePath.join(__dirname, "../../scripts/acp-mock-agent.ts");
31 const decodeSettings = Schema.decodeSync(AcpRegistrySettings);
32
33 describe("ACP Registry probe", () => {
apps/server/src/provider/CodexChatGptAuth.ts
+2 -2
@@ -19,8 +19,8 @@ import * as Effect from "effect/Effect";
19 import * as Option from "effect/Option";
20 import * as Schema from "effect/Schema";
21 import * as Semaphore from "effect/Semaphore";
22 -import * as ProviderAuthFlow from "./ProviderAuthFlow.ts";
23 -import type { ProviderAuthFlowContext } from "./ProviderAuthFlow.ts";
22 +import * as ProviderAuthFlow from "@t3tools/provider-core/server/ProviderAuthFlow";
23 +import type { ProviderAuthFlowContext } from "@t3tools/provider-core/server/ProviderAuthFlow";
24 import { HttpClient, HttpClientRequest } from "effect/http";
25 import * as ProviderCredentialStore from "./ProviderCredentialStore.ts";
26 import { withChatGptSessionLock } from "./CodexChatGptSessionLock.ts";
apps/server/src/provider/ProviderHostLive.ts
+1
@@ -35,6 +35,7 @@ export const layer = Layer.effect(
35 },
36 settings: {
37 get: serverSettings.getSettings,
38 + withSnapshot: serverSettings.withSettingsSnapshot,
39 changes: serverSettings.streamChanges,
40 subscribe: serverSettings.subscribeChanges,
41 },
apps/server/src/provider/ProviderInstanceRegistryHydration.ts
+2 -3
@@ -38,8 +38,7 @@ import { BUILT_IN_DRIVERS, type BuiltInDriversEnv } from "./builtInDrivers.ts";
38 import * as ProviderInstanceRegistry from "./ProviderInstanceRegistry.ts";
39 import * as ProviderInstanceRegistryMutator from "./ProviderInstanceRegistryMutator.ts";
40 import * as ProviderOrchestrationAdapterInfrastructure from "./ProviderOrchestrationAdapterInfrastructure.ts";
41 -import * as AcpRegistrySupport from "./acp/AcpRegistrySupport.ts";
42 -import * as AcpRegistryCatalog from "./AcpRegistryCatalog.ts";
41 +import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
42 import * as ProviderHostLive from "./ProviderHostLive.ts";
43 import type { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
44 import type * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
@@ -144,7 +143,7 @@ export const layer: Layer.Layer<
143 configMap: initialConfigMap,
144 }).pipe(
145 Layer.provide(ProviderOrchestrationAdapterInfrastructure.layer),
147 - Layer.provide(AcpRegistryCatalog.layer),
146 + Layer.provide(AcpRegistrySupport.layerFromHost),
147 Layer.provide(ProviderHostLive.layer),
148 );
149
apps/server/src/provider/builtInDrivers.ts
+4 -1
@@ -20,7 +20,10 @@
20 *
21 * @module provider/builtInDrivers
22 */
23 -import { AcpRegistryDriver, type AcpRegistryDriverEnv } from "./Drivers/AcpRegistryDriver.ts";
23 +import {
24 + AcpRegistryDriver,
25 + type AcpRegistryDriverEnv,
26 +} from "@t3tools/provider-acp-registry/server";
27 import { AntigravityDriver, type AntigravityDriverEnv } from "./Drivers/AntigravityDriver.ts";
28 import { ClaudeDriver, type ClaudeDriverEnv } from "./Drivers/ClaudeDriver.ts";
29 import { CodexDriver, type CodexDriverEnv } from "./Drivers/CodexDriver.ts";
apps/server/src/server.ts
+3 -2
@@ -45,7 +45,8 @@ import * as ResetCreditCoordinator from "./provider/resetCreditCoordinator.ts";
45 import * as ProviderEventLoggers from "./provider/ProviderEventLoggers.ts";
46 import * as OpenCodeRuntime from "@t3tools/provider-opencode/server/OpenCodeRuntime";
47 import * as OpenCodeServerLedger from "@t3tools/provider-opencode/server/OpenCodeServerLedger";
48 -import * as AcpRegistryCatalog from "./provider/AcpRegistryCatalog.ts";
48 +import * as ProviderHostLive from "./provider/ProviderHostLive.ts";
49 +import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
50 import * as CheckpointDiffQuery from "./checkpointing/CheckpointDiffQuery.ts";
51 import * as CheckpointStore from "./checkpointing/CheckpointStore.ts";
52 import * as AzureDevOpsCli from "./sourceControl/AzureDevOpsCli.ts";
@@ -597,7 +598,7 @@ const layerRuntimeCoreDependencies = layerRuntimeCoreDependenciesBase.pipe(
598 Layer.provideMerge(layerPtyAdapter),
599 // Search, prepare, status inspection, and turn launch share one registry
600 // cache so every client and provider instance sees the same prepared agents.
600 - Layer.provideMerge(AcpRegistryCatalog.layer.pipe(Layer.provide(layerServerSettings))),
601 + Layer.provideMerge(AcpRegistrySupport.layerFromHost.pipe(Layer.provide(ProviderHostLive.layer))),
602 // Shared native/canonical NDJSON writers used by both the per-instance
603 // V2 drivers and the orchestration runtime. Provide resource attribution so
604 // the rewritten telemetry pipeline can account for logical NDJSON writes.
apps/server/src/terminal/Manager.test.ts
+1 -1
@@ -41,7 +41,7 @@ import * as SqlitePersistence from "../persistence/Sqlite.ts";
41 import * as ProcessRunner from "../processRunner.ts";
42 import * as ServerSettings from "../serverSettings.ts";
43 import * as TerminalManager from "./Manager.ts";
44 -import * as PtyAdapter from "./PtyAdapter.ts";
44 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
45
46 const encodeUnknownJson = Schema.encodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
47
apps/server/src/terminal/Manager.ts
+2 -2
@@ -45,7 +45,7 @@ import * as KeyedLock from "@t3tools/shared/KeyedLock";
45 import { HostProcessArchitecture, HostProcessPlatform } from "@t3tools/shared/hostProcess";
46 import { mergePathEntries } from "@t3tools/shared/shell";
47
48 -import { acpRegistryManagedBinaryDirectories } from "../provider/acp/AcpRegistrySupport.ts";
48 +import { acpRegistryManagedBinaryDirectories } from "@t3tools/provider-acp-registry/server";
49 import { getTerminalLabel } from "@t3tools/shared/terminalLabels";
50 import * as DateTime from "effect/DateTime";
51 import * as Context from "effect/Context";
@@ -77,7 +77,7 @@ import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
77 import * as ProcessRunner from "../processRunner.ts";
78 import * as PortScanner from "../preview/PortScanner.ts";
79 import * as NativeTelemetryClient from "../resourceTelemetry/NativeTelemetryClient.ts";
80 -import * as PtyAdapter from "./PtyAdapter.ts";
80 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
81
82 export {
83 TerminalCwdError,
apps/server/src/terminal/NodePtyAdapter.test.ts
+1 -1
@@ -14,7 +14,7 @@ import * as Scheduler from "effect/Scheduler";
14 import { expect, vi } from "vite-plus/test";
15
16 import * as NodePtyAdapter from "./NodePtyAdapter.ts";
17 -import * as PtyAdapter from "./PtyAdapter.ts";
17 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
18
19 function makeNativeProcess(pid = 42) {
20 const events = new NodeEvents.EventEmitter();
apps/server/src/terminal/NodePtyAdapter.ts
+1 -1
@@ -9,7 +9,7 @@ import * as Path from "effect/Path";
9 import * as Schema from "effect/Schema";
10 import { HostProcessArchitecture, HostProcessPlatform } from "@t3tools/shared/hostProcess";
11
12 -import * as PtyAdapter from "./PtyAdapter.ts";
12 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
13
14 export class NodePtyModuleLoadError extends Schema.TaggedError<NodePtyModuleLoadError>()(
15 "NodePtyModuleLoadError",
apps/server/src/ws.ts
+2 -2
@@ -165,8 +165,8 @@ import * as OrchestrationEventStore from "./persistence/OrchestrationEventStore.
165 import { userFacingDispatchErrorMessage } from "./orchestration-v2/UserFacingErrors.ts";
166 import * as ProviderRegistry from "./provider/ProviderRegistry.ts";
167 import * as ProviderInstanceRegistry from "./provider/ProviderInstanceRegistry.ts";
168 -import * as AcpRegistrySupport from "./provider/acp/AcpRegistrySupport.ts";
169 -import * as AcpRegistryRuntimeCoordinator from "./provider/acp/AcpRegistryRuntimeCoordinator.ts";
168 +import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
169 +import * as AcpRegistryRuntimeCoordinator from "@t3tools/provider-acp-registry/server/AcpRegistryRuntimeCoordinator";
170 import * as ModelManifest from "./provider/ModelManifest.ts";
171 import * as ProviderMaintenance from "@t3tools/provider-core/server/maintenanceResolver";
172 import * as ProviderMaintenanceRunner from "./provider/providerMaintenanceRunner.ts";
apps/web/package.json
+1
@@ -28,6 +28,7 @@
28 "@pierre/trees": "1.0.0-beta.6",
29 "@t3tools/client-runtime": "workspace:*",
30 "@t3tools/contracts": "workspace:*",
31 + "@t3tools/provider-acp-registry": "workspace:*",
32 "@t3tools/provider-core": "workspace:*",
33 "@t3tools/provider-cursor": "workspace:*",
34 "@t3tools/provider-grok": "workspace:*",
apps/web/src/components/settings/providerDriverMeta.ts
+2 -7
@@ -1,10 +1,10 @@
1 import {
2 - AcpRegistrySettings,
2 AntigravitySettings,
3 ClaudeSettings,
4 CodexSettings,
5 ProviderDriverKind,
6 } from "@t3tools/contracts";
7 +import { acpRegistryClient } from "@t3tools/provider-acp-registry/client";
8 import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
9 import { cursorClient } from "@t3tools/provider-cursor/client";
10 import { grokClient } from "@t3tools/provider-grok/client";
@@ -34,10 +34,5 @@ export const providerClients = makeProviderClientRegistry([
34 },
35 museClient,
36 piClient,
37 - {
38 - driverKind: ProviderDriverKind.make("acpRegistry"),
39 - label: "ACP Registry",
40 - settingsSchema: AcpRegistrySettings,
41 - hasDefaultInstance: false,
42 - },
37 + acpRegistryClient,
38 ]);
package.json
+1 -1
@@ -28,7 +28,7 @@
28 "tc": "vp run -r --concurrency-limit 2 typecheck",
29 "lint": "vp lint --report-unused-disable-directives",
30 "knip": "knip --preprocessor ./scripts/knip-schemas.ts",
31 - "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-acp --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --workspace packages/provider-grok --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
31 + "knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-acp --workspace packages/provider-acp-registry --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --workspace packages/provider-grok --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
32 "knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts",
33 "lint:mobile": "node scripts/mobile-native-static-check.ts",
34 "test": "vp run -r test",
packages/contracts/src/settings.ts
-67
@@ -788,73 +788,6 @@ export const AntigravitySettings = makeProviderSettingsSchema(
788 );
789 export type AntigravitySettings = typeof AntigravitySettings.Type;
790
791 -export const AcpRegistryDistributionPreference = Schema.Literals(["auto", "binary", "npx", "uvx"]);
792 -export type AcpRegistryDistributionPreference = typeof AcpRegistryDistributionPreference.Type;
793 -
794 -export const AcpRegistrySettings = makeProviderSettingsSchema(
795 - {
796 - source: Schema.Literals(["registry", "local"]).pipe(
797 - Schema.withDecodingDefault(Effect.succeed("registry")),
798 - Schema.annotateKey({
799 - title: "ACP source",
800 - providerSettingsForm: {
801 - control: "select",
802 - options: [
803 - { value: "registry", label: "ACP Registry" },
804 - { value: "local", label: "Local command" },
805 - ],
806 - },
807 - }),
808 - ),
809 - enabled: Schema.Boolean.pipe(
810 - Schema.withDecodingDefault(Effect.succeed(true)),
811 - Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
812 - ),
813 - agentId: TrimmedString.pipe(
814 - Schema.withDecodingDefault(Effect.succeed("")),
815 - Schema.annotateKey({
816 - title: "Registry agent ID",
817 - description: "Agent identifier from the official ACP Registry, for example 'devin'.",
818 - providerSettingsForm: { placeholder: "devin", clearWhenEmpty: "persist" },
819 - }),
820 - ),
821 - commandPath: TrimmedString.pipe(
822 - Schema.withDecodingDefault(Effect.succeed("")),
823 - Schema.annotateKey({
824 - title: "Executable override",
825 - description:
826 - "Executable on this environment. For registry agents, this overrides the distribution executable while keeping its arguments and environment.",
827 - providerSettingsForm: { placeholder: "Registry default", clearWhenEmpty: "omit" },
828 - }),
829 - ),
830 - commandArgs: Schema.Array(Schema.String).pipe(
831 - Schema.withDecodingDefault(Effect.succeed([])),
832 - Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
833 - ),
834 - authMethodId: TrimmedString.pipe(
835 - Schema.withDecodingDefault(Effect.succeed("")),
836 - Schema.annotateKey({
837 - title: "Authentication method",
838 - description:
839 - "Optional ACP authentication method ID. By default, the first agent-managed method is selected.",
840 - providerSettingsForm: { placeholder: "auto", clearWhenEmpty: "omit" },
841 - }),
842 - ),
843 - distribution: AcpRegistryDistributionPreference.pipe(
844 - Schema.withDecodingDefault(Effect.succeed("auto")),
845 - Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
846 - ),
847 - customModels: Schema.Array(Schema.String).pipe(
848 - Schema.withDecodingDefault(Effect.succeed([])),
849 - Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
850 - ),
851 - },
852 - {
853 - order: ["source", "agentId", "commandPath", "authMethodId"],
854 - },
855 -);
856 -export type AcpRegistrySettings = typeof AcpRegistrySettings.Type;
857 -
791 /**
792 * A read-only quota source outside this environment's provider CLIs. The
793 * only kind today is a CLIProxyAPI hub, whose management API reports the
packages/provider-acp-registry/package.json new
+51
@@ -0,0 +1,51 @@
1 +{
2 + "name": "@t3tools/provider-acp-registry",
3 + "private": true,
4 + "type": "module",
5 + "exports": {
6 + "./client": {
7 + "types": "./src/client.ts",
8 + "import": "./src/client.ts"
9 + },
10 + "./settings": {
11 + "types": "./src/settings.ts",
12 + "import": "./src/settings.ts"
13 + },
14 + "./server": {
15 + "types": "./src/server.ts",
16 + "import": "./src/server.ts"
17 + },
18 + "./testing": {
19 + "types": "./src/testing.ts",
20 + "import": "./src/testing.ts"
21 + },
22 + "./server/AcpRegistrySupport": {
23 + "types": "./src/server/AcpRegistrySupport.ts",
24 + "import": "./src/server/AcpRegistrySupport.ts"
25 + },
26 + "./server/AcpRegistryRuntimeCoordinator": {
27 + "types": "./src/server/AcpRegistryRuntimeCoordinator.ts",
28 + "import": "./src/server/AcpRegistryRuntimeCoordinator.ts"
29 + }
30 + },
31 + "scripts": {
32 + "typecheck": "tsc --noEmit",
33 + "test": "vp test run --config ../../vite.config.ts --dir ."
34 + },
35 + "dependencies": {
36 + "@noble/hashes": "catalog:",
37 + "@t3tools/contracts": "workspace:*",
38 + "@t3tools/provider-acp": "workspace:*",
39 + "@t3tools/provider-core": "workspace:*",
40 + "@t3tools/shared": "workspace:*",
41 + "effect": "catalog:"
42 + },
43 + "devDependencies": {
44 + "@effect/platform-node": "catalog:",
45 + "@effect/vitest": "catalog:",
46 + "@t3tools/provider-testing": "workspace:*",
47 + "@types/node": "catalog:",
48 + "effect-acp": "workspace:*",
49 + "vite-plus": "catalog:"
50 + }
51 +}
packages/provider-acp-registry/src/client.ts new
+28
@@ -0,0 +1,28 @@
1 +/**
2 + * ACP Registry's client definition: settings form, label, and the registry
3 + * glyph clients fall back to while an agent's own icon loads.
4 + * Browser- and React Native-safe.
5 + *
6 + * @module provider-acp-registry/client
7 + */
8 +import { ProviderDriverKind } from "@t3tools/contracts";
9 +import { defineProviderClient } from "@t3tools/provider-core/client";
10 +
11 +import { AcpRegistrySettings } from "./settings.ts";
12 +
13 +export const acpRegistryClient = defineProviderClient({
14 + driverKind: ProviderDriverKind.make("acpRegistry"),
15 + label: "ACP Registry",
16 + settingsSchema: AcpRegistrySettings,
17 + // Each instance is an agent the user adds from the registry.
18 + hasDefaultInstance: false,
19 + icon: {
20 + viewBox: "0 0 576 220",
21 + fill: { light: "#000000", dark: "#FFFFFF" },
22 + paths: [
23 + {
24 + d: "M568.003 115.821L517.278 27.9661C507.183 10.4816 489.084 0.0227367 468.894 0.0227367C448.727 0.0227367 430.674 10.4361 420.556 27.8752L343.251 161.749H242.755C236.23 161.749 230.386 158.384 227.135 152.745C223.861 147.106 223.861 140.376 227.135 134.715L277.861 46.8603C281.112 41.2216 286.955 37.8338 293.481 37.8338C300.006 37.8338 305.827 41.1988 309.101 46.8603L312.125 52.0897C313.353 54.2042 315.604 55.5002 318.036 55.5002C320.469 55.5002 322.743 54.1815 323.948 52.067L337.385 28.5118C338.795 26.0335 338.522 22.9413 336.703 20.7586C325.699 7.57131 309.874 0 293.322 0C292.662 0 292.003 0 291.321 0.0454733C272.04 0.75031 254.76 11.1864 245.074 27.9434L200.215 105.657L155.81 29.1484C145.465 11.2092 126.594 0.0227367 106.608 0.0227367C105.949 0.0227367 105.289 0.0227367 104.607 0.06821C85.3265 0.773047 68.0467 11.2092 58.3608 27.9661L7.65806 115.821C-6.25678 139.899 -0.868187 168.82 21.05 187.759C29.8945 195.422 41.6039 199.628 54.0181 199.628H148.648C151.081 199.628 153.332 198.332 154.56 196.217L168.52 172.026C169.748 169.911 169.748 167.319 168.52 165.205C167.292 163.09 165.041 161.794 162.608 161.794H56.0417C49.5163 161.794 43.6729 158.429 40.4216 152.79C37.1475 147.152 37.1475 140.422 40.4216 134.76L91.1471 46.9057C94.3985 41.2671 100.242 37.8793 106.767 37.8793C113.293 37.8793 119.113 41.2443 122.387 46.9057L194.826 172.526C195.031 172.89 195.258 173.208 195.531 173.526C198.76 178.665 202.83 183.485 207.786 187.782C216.631 195.444 228.34 199.651 240.754 199.651H321.424L315.581 209.769C314.353 211.883 314.353 214.475 315.581 216.59C316.809 218.704 319.059 220 321.492 220H349.436C351.868 220 354.119 218.704 355.347 216.59L364.396 200.901L367.17 196.468C367.17 196.468 367.261 196.331 367.284 196.263L453.274 46.9285C456.525 41.2898 462.369 37.902 468.894 37.902C475.42 37.902 481.263 41.2671 484.514 46.9285L535.24 134.783C538.491 140.422 538.514 147.174 535.24 152.813C531.988 158.452 526.145 161.84 519.62 161.84H418.669C416.236 161.84 413.985 163.136 412.757 165.25L398.774 189.442C397.546 191.556 397.546 194.148 398.774 196.263C400.002 198.377 402.253 199.673 404.686 199.673H518.21C539.81 199.673 559.295 188.237 569.026 169.843C578.053 152.79 577.666 132.623 567.981 115.843L568.003 115.821Z",
25 + },
26 + ],
27 + },
28 +});
packages/provider-acp-registry/src/server.ts new
+16
@@ -0,0 +1,16 @@
1 +/**
2 + * ACP Registry's server entry: the driver and adapter driver the server
3 + * registers, the catalog layer it provides once, and the managed-binary
4 + * directories the terminal manager keeps off agent PATHs.
5 + *
6 + * The catalog and runtime coordinator are services; import them from
7 + * `./server/AcpRegistrySupport` and `./server/AcpRegistryRuntimeCoordinator`.
8 + *
9 + * @module provider-acp-registry/server
10 + */
11 +export { AcpRegistryDriver, type AcpRegistryDriverEnv } from "./server/driver.ts";
12 +export {
13 + AcpRegistryAdapterV2Driver,
14 + type AcpRegistryAdapterV2DriverEnv,
15 +} from "./server/adapter.ts";
16 +export { acpRegistryManagedBinaryDirectories } from "./server/AcpRegistrySupport.ts";
packages/provider-acp-registry/src/server/AcpRegistryRuntimeCoordinator.test.ts renamed
+10 -40
@@ -6,10 +6,7 @@ import * as Fiber from "effect/Fiber";
6 import * as Option from "effect/Option";
7 import * as TestClock from "effect/testing/TestClock";
8
9 -import type {
10 - AcpRegistryAvailableCommands,
11 - AcpRegistryLiveConfiguration,
12 -} from "./AcpRegistryProbe.ts";
9 +import type { AcpRegistryAvailableCommands, AcpRegistryLiveConfiguration } from "./probe.ts";
10 import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
11
12 describe("AcpRegistryRuntimeCoordinator", () => {
@@ -33,10 +30,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
30
31 yield* Deferred.succeed(releaseForeground, undefined);
32 yield* Fiber.join(foreground);
36 - }).pipe(
37 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
38 - Effect.scoped,
39 - ),
33 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
34 );
35
36 it.effect("interrupts an active background probe when foreground startup begins", () =>
@@ -64,10 +58,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
58
59 yield* Deferred.succeed(releaseForeground, undefined);
60 yield* Fiber.join(foreground);
67 - }).pipe(
68 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
69 - Effect.scoped,
70 - ),
61 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
62 );
63
64 it.effect("serializes native session mutations across callers", () =>
@@ -94,10 +85,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
85 yield* Fiber.join(first);
86 yield* Fiber.join(second);
87 expect(Option.isSome(yield* Deferred.poll(secondEntered))).toBe(true);
97 - }).pipe(
98 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
99 - Effect.scoped,
100 - ),
88 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
89 );
90
91 it.effect("replays and replaces late command advertisements per provider instance", () =>
@@ -145,10 +133,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
133 );
134 yield* coordinator.clearAvailableCommands(codex);
135 expect(Option.isNone(yield* coordinator.getAvailableCommands(codex))).toBe(true);
148 - }).pipe(
149 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
150 - Effect.scoped,
151 - ),
136 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
137 );
138
139 it.effect("replays and replaces live configuration per provider instance", () =>
@@ -189,10 +174,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
174 expect(yield* coordinator.getLiveConfiguration(instanceId)).toEqual(Option.some(replacement));
175 yield* coordinator.clearLiveConfiguration(instanceId);
176 expect(Option.isNone(yield* coordinator.getLiveConfiguration(instanceId))).toBe(true);
192 - }).pipe(
193 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
194 - Effect.scoped,
195 - ),
177 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
178 );
179
180 it.effect("requires matching user consent before accepting URL authentication", () =>
@@ -234,10 +216,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
216 expect(yield* Fiber.join(request)).toBe(true);
217 expect(Option.isNone(yield* coordinator.getUrlAuthAction(instanceId))).toBe(true);
218 yield* Fiber.interrupt(consumer);
237 - }).pipe(
238 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
239 - Effect.scoped,
240 - ),
219 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
220 );
221
222 it.effect("expires stale URL authentication actions without accepting them", () =>
@@ -271,10 +250,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
250 ).toBe(false);
251 expect(Option.isNone(yield* coordinator.getUrlAuthAction(instanceId))).toBe(true);
252 yield* Fiber.interrupt(consumer);
274 - }).pipe(
275 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
276 - Effect.scoped,
277 - ),
253 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
254 );
255
256 it.effect("publishes a replacement URL action before retiring the previous request", () =>
@@ -326,10 +302,7 @@ describe("AcpRegistryRuntimeCoordinator", () => {
302 ).toBe(true);
303 expect(yield* Fiber.join(replacement)).toBe(true);
304 yield* Fiber.interrupt(consumer);
329 - }).pipe(
330 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
331 - Effect.scoped,
332 - ),
305 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
306 );
307
308 it.effect("clears a published URL action when its request is interrupted", () =>
@@ -358,9 +331,6 @@ describe("AcpRegistryRuntimeCoordinator", () => {
331 yield* Deferred.await(cleared);
332 expect(Option.isNone(yield* coordinator.getUrlAuthAction(instanceId))).toBe(true);
333 yield* Fiber.interrupt(consumer);
361 - }).pipe(
362 - Effect.provide(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator.layer),
363 - Effect.scoped,
364 - ),
334 + }).pipe(Effect.provide(AcpRegistryRuntimeCoordinator.layer), Effect.scoped),
335 );
336 });
packages/provider-acp-registry/src/server/AcpRegistryRuntimeCoordinator.ts renamed
+3 -10
@@ -15,10 +15,7 @@ import * as Ref from "effect/Ref";
15 import * as Semaphore from "effect/Semaphore";
16 import * as Stream from "effect/Stream";
17
18 -import type {
19 - AcpRegistryAvailableCommands,
20 - AcpRegistryLiveConfiguration,
21 -} from "./AcpRegistryProbe.ts";
18 +import type { AcpRegistryAvailableCommands, AcpRegistryLiveConfiguration } from "./probe.ts";
19
20 interface AvailableCommandsUpdate {
21 readonly instanceId: ProviderInstanceId;
@@ -99,11 +96,7 @@ export class AcpRegistryRuntimeCoordinator extends Context.Service<
96 onUpdate: (action: AcpRegistryUrlAuthAction | null) => Effect.Effect<void>,
97 ) => Effect.Effect<void>;
98 }
102 ->()("t3/provider/acp/AcpRegistryRuntimeCoordinator") {
103 - static get layer() {
104 - return layer;
105 - }
106 -}
99 +>()("@t3tools/provider-acp-registry/server/AcpRegistryRuntimeCoordinator") {}
100
101 const make = Effect.gen(function* () {
102 const foregroundStarts = yield* PubSub.unbounded<string>();
@@ -366,4 +359,4 @@ const make = Effect.gen(function* () {
359 });
360 });
361
369 -const layer = Layer.effect(AcpRegistryRuntimeCoordinator, make);
362 +export const layer = Layer.effect(AcpRegistryRuntimeCoordinator, make);
packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts renamed
+39 -27
@@ -1,6 +1,11 @@
1 import * as NodeServices from "@effect/platform-node/NodeServices";
2 import { describe, expect, it } from "@effect/vitest";
3 -import { AcpRegistrySettings, ProviderDriverKind, ProviderInstanceId } from "@t3tools/contracts";
3 +import {
4 + DEFAULT_SERVER_SETTINGS,
5 + ProviderDriverKind,
6 + ProviderInstanceId,
7 +} from "@t3tools/contracts";
8 +import { AcpRegistrySettings } from "../settings.ts";
9 import {
10 HostProcessArchitecture,
11 HostProcessEnvironment,
@@ -19,7 +24,7 @@ import * as TestClock from "effect/testing/TestClock";
24 import { ChildProcess, ChildProcessSpawner } from "effect/process";
25
26 import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
22 -import * as ServerSettings from "../../serverSettings.ts";
27 +import { layerTestProviderHost, TestProviderHostSettings } from "@t3tools/provider-testing/host";
28
29 const registryUrl = "https://registry.test/registry.json";
30 const archiveUrl = "https://registry.test/example-agent.bin";
@@ -55,7 +60,7 @@ function layerResolver(
60 ) {
61 return Layer.mergeAll(
62 NodeServices.layer,
58 - ServerSettings.layerTest(),
63 + layerTestProviderHost().pipe(Layer.provide(NodeServices.layer)),
64 Layer.succeed(HostProcessPlatform, "linux"),
65 Layer.succeed(HostProcessArchitecture, "x64"),
66 Layer.succeed(HostProcessEnvironment, environment),
@@ -768,7 +773,12 @@ describe("AcpRegistrySupport", () => {
773 );
774 }).pipe(
775 Effect.scoped,
771 - Effect.provide(Layer.mergeAll(NodeServices.layer, ServerSettings.layerTest())),
776 + Effect.provide(
777 + Layer.mergeAll(
778 + NodeServices.layer,
779 + layerTestProviderHost().pipe(Layer.provide(NodeServices.layer)),
780 + ),
781 + ),
782 Effect.provideService(HostProcessPlatform, "linux"),
783 Effect.provideService(HostProcessArchitecture, "x64"),
784 );
@@ -1364,26 +1374,27 @@ describe("AcpRegistrySupport", () => {
1374 toolsDir: `${cacheDir}/tools`,
1375 registryUrl,
1376 });
1367 - const serverSettings = yield* ServerSettings.ServerSettingsService;
1377 + const hostSettings = yield* TestProviderHostSettings;
1378 const instanceId = ProviderInstanceId.make("uninstall-reference");
1369 - yield* serverSettings.updateProviderInstance({
1370 - operation: "upsert",
1371 - instanceId,
1372 - instance: {
1373 - driver: ProviderDriverKind.make("acpRegistry"),
1374 - displayName: "Uninstall reference",
1375 - enabled: true,
1376 - config: {
1377 - agentId,
1378 - commandPath: "/local/agent",
1379 - ...(source ? { source } : {}),
1379 + yield* hostSettings.set({
1380 + ...DEFAULT_SERVER_SETTINGS,
1381 + providerInstances: {
1382 + [instanceId]: {
1383 + driver: ProviderDriverKind.make("acpRegistry"),
1384 + displayName: "Uninstall reference",
1385 + enabled: true,
1386 + config: {
1387 + agentId,
1388 + commandPath: "/local/agent",
1389 + ...(source ? { source } : {}),
1390 + },
1391 },
1392 },
1393 });
1394 const first = yield* resolver.uninstallManagedBinary({ agentId: "example-agent" });
1395 expect(first).toEqual({ agentId: "example-agent", removed: !referenced });
1396 expect(yield* fileSystem.exists(agentRoot)).toBe(referenced);
1386 - yield* serverSettings.updateProviderInstance({ operation: "remove", instanceId });
1397 + yield* hostSettings.set(DEFAULT_SERVER_SETTINGS);
1398 const second = yield* resolver.uninstallManagedBinary({ agentId: "example-agent" });
1399
1400 expect(second).toEqual({ agentId: "example-agent", removed: referenced });
@@ -1481,23 +1492,24 @@ describe("AcpRegistrySupport", () => {
1492 const agentRoot = `${cacheDir}/tools/${agent.id}`;
1493 expect(yield* fileSystem.exists(agentRoot)).toBe(true);
1494
1484 - const serverSettings = yield* ServerSettings.ServerSettingsService;
1495 + const hostSettings = yield* TestProviderHostSettings;
1496 const instanceId = ProviderInstanceId.make("registry-reference");
1486 - yield* serverSettings.updateProviderInstance({
1487 - operation: "upsert",
1488 - instanceId,
1489 - instance: {
1490 - driver: ProviderDriverKind.make("acpRegistry"),
1491 - displayName: "Registry reference",
1492 - enabled: true,
1493 - config: { agentId: agent.id },
1497 + yield* hostSettings.set({
1498 + ...DEFAULT_SERVER_SETTINGS,
1499 + providerInstances: {
1500 + [instanceId]: {
1501 + driver: ProviderDriverKind.make("acpRegistry"),
1502 + displayName: "Registry reference",
1503 + enabled: true,
1504 + config: { agentId: agent.id },
1505 + },
1506 },
1507 });
1508 expect(yield* resolver.uninstallManagedBinary({ agentId: agent.id })).toEqual({
1509 agentId: agent.id,
1510 removed: false,
1511 });
1500 - yield* serverSettings.updateProviderInstance({ operation: "remove", instanceId });
1512 + yield* hostSettings.set(DEFAULT_SERVER_SETTINGS);
1513 expect(yield* resolver.uninstallManagedBinary({ agentId: agent.id })).toEqual({
1514 agentId: agent.id,
1515 removed: true,
packages/provider-acp-registry/src/server/AcpRegistrySupport.ts renamed
+32 -12
@@ -9,9 +9,9 @@ import {
9 type AcpRegistrySearchInput,
10 type AcpRegistrySearchResult,
11 type AcpRegistryDistribution as AcpRegistryDistributionKind,
12 - type AcpRegistryDistributionPreference,
13 - type AcpRegistrySettings,
12 } from "@t3tools/contracts";
13 +import type { AcpRegistryDistributionPreference } from "../settings.ts";
14 +import type { AcpRegistrySettings } from "../settings.ts";
15 import {
16 HostProcessArchitecture,
17 HostProcessEnvironment,
@@ -32,6 +32,7 @@ import * as FileSystem from "effect/FileSystem";
32 import * as Layer from "effect/Layer";
33 import * as Option from "effect/Option";
34 import * as Path from "effect/Path";
35 +import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
36 import * as PlatformError from "effect/PlatformError";
37 import * as Ref from "effect/Ref";
38 import * as Schema from "effect/Schema";
@@ -42,7 +43,7 @@ import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
43 import { ChildProcess, ChildProcessSpawner } from "effect/process";
44
45 import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
45 -import * as ServerSettings from "../../serverSettings.ts";
46 +import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
47 import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
48
49 const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
@@ -503,11 +504,30 @@ export class AcpRegistryCatalog extends Context.Service<
504 input: AcpRegistryManagedBinaryUninstallInput,
505 ) => Effect.Effect<AcpRegistryManagedBinaryUninstallResult, AcpRegistryError>;
506 }
506 ->()("t3/provider/acp/AcpRegistrySupport/AcpRegistryCatalog") {
507 - static layer(options: AcpRegistryCatalogOptions) {
508 - return Layer.effect(AcpRegistryCatalog, makeAcpRegistryCatalog(options));
509 - }
510 -}
507 +>()("@t3tools/provider-acp-registry/server/AcpRegistrySupport/AcpRegistryCatalog") {}
508 +
509 +const layer = (options: AcpRegistryCatalogOptions) =>
510 + Layer.effect(AcpRegistryCatalog, makeAcpRegistryCatalog(options));
511 +
512 +/**
513 + * The server-lifetime catalog, with the runtime coordinator built alongside
514 + * it so setup, snapshots, and turn launch share one of each. Its cache lives
515 + * in the host's provider status cache and installed agents under the T3
516 + * home's `tools` directory.
517 + */
518 +export const layerFromHost = Layer.merge(
519 + Layer.unwrap(
520 + Effect.gen(function* () {
521 + const { paths } = yield* ProviderHost.ProviderHost;
522 + const path = yield* Path.Path;
523 + return layer({
524 + cacheDir: paths.providerStatusCacheDir,
525 + toolsDir: path.join(paths.baseDir, "tools"),
526 + });
527 + }),
528 + ),
529 + AcpRegistryRuntimeCoordinator.layer,
530 +);
531
532 export interface AcpRegistryCatalogOptions {
533 readonly cacheDir: string;
@@ -603,7 +623,7 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
623 | FileSystem.FileSystem
624 | HttpClient.HttpClient
625 | Path.Path
606 - | ServerSettings.ServerSettingsService
626 + | ProviderHost.ProviderHost
627 > {
628 const crypto = yield* Crypto.Crypto;
629 const sha256Hex = (data: Uint8Array) =>
@@ -612,7 +632,7 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
632 const path = yield* Path.Path;
633 const httpClient = yield* HttpClient.HttpClient;
634 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
615 - const serverSettings = yield* ServerSettings.ServerSettingsService;
635 + const { settings: hostSettings } = yield* ProviderHost.ProviderHost;
636 const platform = yield* HostProcessPlatform;
637 const architecture = yield* HostProcessArchitecture;
638 const hostEnvironment = yield* HostProcessEnvironment;
@@ -1842,8 +1862,8 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
1862 });
1863
1864 const uninstallManagedBinary: AcpRegistryCatalog["Service"]["uninstallManagedBinary"] = (input) =>
1845 - serverSettings
1846 - .withSettingsSnapshot((settings) =>
1865 + hostSettings
1866 + .withSnapshot((settings) =>
1867 installSemaphore.withPermits(1)(
1868 Effect.gen(function* () {
1869 const safeAgentId = yield* decodeBoundedAgentId(input.agentId).pipe(
packages/provider-acp-registry/src/server/adapter.ts renamed
+7 -10
@@ -2,12 +2,9 @@ import {
2 normalizeDevinSessionUpdate,
3 normalizeDevinToolCall,
4 extractDevinSubagentUpdate,
5 -} from "./DevinAcp.ts";
6 -import {
7 - AcpRegistrySettings,
8 - defaultInstanceIdForDriver,
9 - ProviderDriverKind,
10 -} from "@t3tools/contracts";
5 +} from "./devinAcp.ts";
6 +import { defaultInstanceIdForDriver, ProviderDriverKind } from "@t3tools/contracts";
7 +import { AcpRegistrySettings } from "../settings.ts";
8 import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
9 import { resolveSelfInvocation, type SelfInvocation } from "@t3tools/shared/nodeRuntime";
10 import * as Crypto from "effect/Crypto";
@@ -26,12 +23,12 @@ import {
23 normalizeAcpRegistryCommands,
24 normalizeAcpRegistryLiveConfiguration,
25 normalizeAcpRegistryWebUrl,
29 -} from "../../provider/acp/AcpRegistryProbe.ts";
30 -import * as AcpRegistrySupport from "../../provider/acp/AcpRegistrySupport.ts";
31 -import * as AcpRegistryRuntimeCoordinator from "../../provider/acp/AcpRegistryRuntimeCoordinator.ts";
26 +} from "./probe.ts";
27 +import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
28 +import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
29 import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
30 import { makeAcpNativeLoggerFactory } from "@t3tools/provider-acp/server/nativeLogging";
34 -import * as ProviderEventLoggers from "../../provider/ProviderEventLoggers.ts";
31 +import * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
32 import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
33 import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
34 import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
packages/provider-acp-registry/src/server/auth.test.ts renamed
+4 -7
@@ -1,10 +1,7 @@
1 import * as NodeServices from "@effect/platform-node/NodeServices";
2 import { assert, it } from "@effect/vitest";
3 -import {
4 - AcpRegistrySettings,
5 - ProviderInstanceId,
6 - type ProviderAuthState,
7 -} from "@t3tools/contracts";
3 +import { ProviderInstanceId, type ProviderAuthState } from "@t3tools/contracts";
4 +import { AcpRegistrySettings } from "../settings.ts";
5 import * as Deferred from "effect/Deferred";
6 import * as Effect from "effect/Effect";
7 import * as Option from "effect/Option";
@@ -13,8 +10,8 @@ import * as Stream from "effect/Stream";
10 import type * as AcpSchema from "effect-acp/compat";
11 import { AcpRequestError } from "effect-acp/errors";
12
16 -import * as PtyAdapter from "../../terminal/PtyAdapter.ts";
17 -import { makeAcpRegistryAuth } from "./AcpRegistryAuth.ts";
13 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
14 +import { makeAcpRegistryAuth } from "./auth.ts";
15 import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
16 import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
17
packages/provider-acp-registry/src/server/auth.ts renamed
+4 -4
@@ -1,9 +1,9 @@
1 import {
2 ProviderSetupError,
3 - type AcpRegistrySettings,
3 type ProviderAuthMethod,
4 type ProviderInstanceId,
5 } from "@t3tools/contracts";
6 +import type { AcpRegistrySettings } from "../settings.ts";
7 import * as Crypto from "effect/Crypto";
8 import * as Deferred from "effect/Deferred";
9 import * as Effect from "effect/Effect";
@@ -15,9 +15,9 @@ import * as Scope from "effect/Scope";
15 import { ChildProcessSpawner } from "effect/process";
16 import type * as AcpSchema from "effect-acp/compat";
17
18 -import * as PtyAdapter from "../../terminal/PtyAdapter.ts";
19 -import * as ProviderAuthFlow from "../ProviderAuthFlow.ts";
20 -import { normalizeAcpRegistryAuthMethods, normalizeAcpRegistryWebUrl } from "./AcpRegistryProbe.ts";
18 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
19 +import * as ProviderAuthFlow from "@t3tools/provider-core/server/ProviderAuthFlow";
20 +import { normalizeAcpRegistryAuthMethods, normalizeAcpRegistryWebUrl } from "./probe.ts";
21 import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
22 import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
23 import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
packages/provider-acp-registry/src/server/authenticationState.test.ts renamed
+3 -2
@@ -1,11 +1,12 @@
1 import * as NodeServices from "@effect/platform-node/NodeServices";
2 import { assert, it } from "@effect/vitest";
3 -import { AcpRegistrySettings, ProviderInstanceId } from "@t3tools/contracts";
3 +import { ProviderInstanceId } from "@t3tools/contracts";
4 +import { AcpRegistrySettings } from "../settings.ts";
5 import * as Effect from "effect/Effect";
6 import * as FileSystem from "effect/FileSystem";
7 import * as Schema from "effect/Schema";
8
8 -import { makeAcpRegistryAuthenticationState } from "./AcpRegistryAuthenticationState.ts";
9 +import { makeAcpRegistryAuthenticationState } from "./authenticationState.ts";
10
11 const settings = Schema.decodeSync(AcpRegistrySettings)({ agentId: "devin" });
12
packages/provider-acp-registry/src/server/authenticationState.ts renamed
+2 -5
@@ -1,8 +1,5 @@
1 -import type {
2 - AcpRegistrySettings,
3 - ProviderInstanceEnvironment,
4 - ProviderInstanceId,
5 -} from "@t3tools/contracts";
1 +import type { ProviderInstanceEnvironment, ProviderInstanceId } from "@t3tools/contracts";
2 +import type { AcpRegistrySettings } from "../settings.ts";
3 import * as Crypto from "effect/Crypto";
4 import * as Effect from "effect/Effect";
5 import * as Hex from "effect/encoding/Hex";
packages/provider-acp-registry/src/server/devinAcp.ts renamed
packages/provider-acp-registry/src/server/driver.test.ts renamed
+4 -7
@@ -1,14 +1,11 @@
1 -import {
2 - AcpRegistryOperationError,
3 - AcpRegistrySettings,
4 - ProviderInstanceId,
5 -} from "@t3tools/contracts";
1 +import { AcpRegistryOperationError, ProviderInstanceId } from "@t3tools/contracts";
2 +import { AcpRegistrySettings } from "../settings.ts";
3 import { describe, expect, it } from "@effect/vitest";
4 import * as Effect from "effect/Effect";
5 import * as Option from "effect/Option";
6 import * as Schema from "effect/Schema";
7
11 -import * as AcpRegistrySupport from "../acp/AcpRegistrySupport.ts";
8 +import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
9 import {
10 acpRegistrySnapshotReadiness,
11 applyAcpRegistryAvailableCommands,
@@ -16,7 +13,7 @@ import {
13 buildCheckedAcpRegistrySnapshot,
14 checkAcpRegistryProviderReadiness,
15 checkAcpRegistryProviderStatus,
19 -} from "./AcpRegistryDriver.ts";
16 +} from "./driver.ts";
17
18 const decodeSettings = Schema.decodeSync(AcpRegistrySettings);
19 const identity = {
packages/provider-acp-registry/src/server/driver.ts renamed
+10 -13
@@ -1,5 +1,4 @@
1 import {
2 - AcpRegistrySettings,
2 officialAcpRegistryIconUrlForAgentId,
3 ProviderDriverKind,
4 resolveOfficialAcpRegistryIconUrl,
@@ -8,6 +7,7 @@ import {
7 type ServerProvider,
8 type ServerProviderModel,
9 } from "@t3tools/contracts";
10 +import { AcpRegistrySettings } from "../settings.ts";
11 import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
12 import { createModelCapabilities } from "@t3tools/shared/model";
13 import * as Clock from "effect/Clock";
@@ -22,12 +22,9 @@ import * as Semaphore from "effect/Semaphore";
22 import { ChildProcessSpawner } from "effect/process";
23
24 import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
25 -import {
26 - AcpRegistryAdapterV2Driver,
27 - type AcpRegistryAdapterV2DriverEnv,
28 -} from "../../orchestration-v2/Adapters/AcpRegistryAdapterV2.ts";
29 -import type { TextGeneration } from "../../textGeneration/TextGeneration.ts";
30 -import { ProviderDriverError } from "../Errors.ts";
25 +import { AcpRegistryAdapterV2Driver, type AcpRegistryAdapterV2DriverEnv } from "./adapter.ts";
26 +import type { ProviderTextGeneration } from "@t3tools/provider-core/server/textGeneration";
27 +import { ProviderDriverError } from "@t3tools/provider-core/server/errors";
28 import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
29 import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
30 import {
@@ -54,11 +51,11 @@ import {
51 logoutAcpRegistry,
52 probeAcpRegistryConfiguration,
53 setAcpRegistryProvider,
57 -} from "../acp/AcpRegistryProbe.ts";
58 -import * as AcpRegistrySupport from "../acp/AcpRegistrySupport.ts";
59 -import * as AcpRegistryRuntimeCoordinator from "../acp/AcpRegistryRuntimeCoordinator.ts";
60 -import * as AcpRegistryAuth from "../acp/AcpRegistryAuth.ts";
61 -import * as AcpRegistryAuthenticationState from "../acp/AcpRegistryAuthenticationState.ts";
54 +} from "./probe.ts";
55 +import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
56 +import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
57 +import * as AcpRegistryAuth from "./auth.ts";
58 +import * as AcpRegistryAuthenticationState from "./authenticationState.ts";
59
60 const DRIVER_KIND = ProviderDriverKind.make("acpRegistry");
61 const decodeSettings = Schema.decodeSync(AcpRegistrySettings);
@@ -73,7 +70,7 @@ const MAINTENANCE = makeManualOnlyProviderMaintenanceCapabilities({
70 packageName: null,
71 });
72
76 -const makeUnsupportedTextGeneration = (): TextGeneration["Service"] => {
73 +const makeUnsupportedTextGeneration = (): ProviderTextGeneration => {
74 const unsupported = (operation: string) =>
75 Effect.fail(
76 new TextGenerationError({
packages/provider-acp-registry/src/server/probe.ts renamed
+2 -2
@@ -3,7 +3,6 @@ import {
3 AcpRegistryOperationError,
4 AcpRegistryListSessionsResult,
5 AcpRegistryProbeResult,
6 - AcpRegistrySettings,
6 type AcpRegistryProbeAuthMethod,
7 type AcpRegistryProbeModel,
8 type AcpRegistryUrlAuthAction,
@@ -11,6 +10,7 @@ import {
10 type ServerProviderSkill,
11 type ServerProviderSlashCommand,
12 } from "@t3tools/contracts";
13 +import { AcpRegistrySettings } from "../settings.ts";
14 import * as Crypto from "effect/Crypto";
15 import * as Deferred from "effect/Deferred";
16 import * as Duration from "effect/Duration";
@@ -23,7 +23,7 @@ import { ChildProcessSpawner } from "effect/process";
23 import type * as EffectAcpErrors from "effect-acp/errors";
24 import type * as EffectAcpSchema from "effect-acp/compat";
25
26 -import * as PtyAdapter from "../../terminal/PtyAdapter.ts";
26 +import * as PtyAdapter from "@t3tools/shared/PtyAdapter";
27 import * as AcpRegistrySupport from "./AcpRegistrySupport.ts";
28 import { parseSessionModeState } from "@t3tools/provider-acp/server/runtimeModel";
29 import { acpProviderOptionDescriptors } from "@t3tools/provider-acp/server/sessionConfig";
packages/provider-acp-registry/src/server/testing/AcpRegistrySupport.npm.fixture.sh renamed
packages/provider-acp-registry/src/server/testing/AcpRegistrySupport.uv.fixture.sh renamed
packages/provider-acp-registry/src/settings.ts new
+76
@@ -0,0 +1,76 @@
1 +/**
2 + * ACP Registry instance settings. Shared by the server driver and the client
3 + * settings form, so it holds only browser-safe schema code.
4 + *
5 + * @module provider-acp-registry/settings
6 + */
7 +import { TrimmedString, makeProviderSettingsSchema } from "@t3tools/contracts";
8 +import * as Effect from "effect/Effect";
9 +import * as Schema from "effect/Schema";
10 +
11 +export const AcpRegistryDistributionPreference = Schema.Literals(["auto", "binary", "npx", "uvx"]);
12 +export type AcpRegistryDistributionPreference = typeof AcpRegistryDistributionPreference.Type;
13 +
14 +export const AcpRegistrySettings = makeProviderSettingsSchema(
15 + {
16 + source: Schema.Literals(["registry", "local"]).pipe(
17 + Schema.withDecodingDefault(Effect.succeed("registry")),
18 + Schema.annotateKey({
19 + title: "ACP source",
20 + providerSettingsForm: {
21 + control: "select",
22 + options: [
23 + { value: "registry", label: "ACP Registry" },
24 + { value: "local", label: "Local command" },
25 + ],
26 + },
27 + }),
28 + ),
29 + enabled: Schema.Boolean.pipe(
30 + Schema.withDecodingDefault(Effect.succeed(true)),
31 + Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
32 + ),
33 + agentId: TrimmedString.pipe(
34 + Schema.withDecodingDefault(Effect.succeed("")),
35 + Schema.annotateKey({
36 + title: "Registry agent ID",
37 + description: "Agent identifier from the official ACP Registry, for example 'devin'.",
38 + providerSettingsForm: { placeholder: "devin", clearWhenEmpty: "persist" },
39 + }),
40 + ),
41 + commandPath: TrimmedString.pipe(
42 + Schema.withDecodingDefault(Effect.succeed("")),
43 + Schema.annotateKey({
44 + title: "Executable override",
45 + description:
46 + "Executable on this environment. For registry agents, this overrides the distribution executable while keeping its arguments and environment.",
47 + providerSettingsForm: { placeholder: "Registry default", clearWhenEmpty: "omit" },
48 + }),
49 + ),
50 + commandArgs: Schema.Array(Schema.String).pipe(
51 + Schema.withDecodingDefault(Effect.succeed([])),
52 + Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
53 + ),
54 + authMethodId: TrimmedString.pipe(
55 + Schema.withDecodingDefault(Effect.succeed("")),
56 + Schema.annotateKey({
57 + title: "Authentication method",
58 + description:
59 + "Optional ACP authentication method ID. By default, the first agent-managed method is selected.",
60 + providerSettingsForm: { placeholder: "auto", clearWhenEmpty: "omit" },
61 + }),
62 + ),
63 + distribution: AcpRegistryDistributionPreference.pipe(
64 + Schema.withDecodingDefault(Effect.succeed("auto")),
65 + Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
66 + ),
67 + customModels: Schema.Array(Schema.String).pipe(
68 + Schema.withDecodingDefault(Effect.succeed([])),
69 + Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
70 + ),
71 + },
72 + {
73 + order: ["source", "agentId", "commandPath", "authMethodId"],
74 + },
75 +);
76 +export type AcpRegistrySettings = typeof AcpRegistrySettings.Type;
packages/provider-acp-registry/src/testing.ts new
+29
@@ -0,0 +1,29 @@
1 +/**
2 + * ACP Registry internals the server's replay testkit and ACP adapter tests
3 + * drive directly.
4 + *
5 + * @module provider-acp-registry/testing
6 + */
7 +export {
8 + ACP_REGISTRY_DEFAULT_INSTANCE_ID,
9 + ACP_REGISTRY_PROVIDER,
10 + acpRegistryPromptFailure,
11 + makeAcpRegistryAdapterV2,
12 + registerMistralVibeAcpExtensions,
13 +} from "./server/adapter.ts";
14 +export {
15 + extractDevinSubagentUpdate,
16 + normalizeDevinSessionUpdate,
17 + normalizeDevinToolCall,
18 +} from "./server/devinAcp.ts";
19 +export {
20 + acpRegistryProbeFailure,
21 + acpRegistryProbeResult,
22 + listAcpRegistrySessions,
23 + logoutAcpRegistry,
24 + normalizeAcpRegistryAuthMethods,
25 + normalizeAcpRegistryCommands,
26 + probeAcpRegistryConfiguration,
27 + type AcpRegistryAvailableCommands,
28 + type AcpRegistryLiveConfiguration,
29 +} from "./server/probe.ts";
packages/provider-acp-registry/tsconfig.json new
+8
@@ -0,0 +1,8 @@
1 +{
2 + "extends": "../../tsconfig.base.json",
3 + "compilerOptions": {
4 + "types": ["node"],
5 + "lib": ["ESNext", "esnext.disposable"]
6 + },
7 + "include": ["src"]
8 +}
packages/provider-acp/src/server/AcpSessionRuntime.ts
+1 -11
@@ -1329,17 +1329,7 @@ export class AcpSessionRuntime extends Context.Service<
1329 payload: unknown,
1330 ) => Effect.Effect<void, EffectAcpErrors.AcpError>;
1331 }
1332 ->()("@t3tools/provider-acp/server/AcpSessionRuntime") {
1333 - static layer(
1334 - options: AcpSessionRuntimeOptions,
1335 - ): Layer.Layer<
1336 - AcpSessionRuntime,
1337 - EffectAcpErrors.AcpError,
1338 - ChildProcessSpawner.ChildProcessSpawner | Crypto.Crypto
1339 - > {
1340 - return Layer.effect(AcpSessionRuntime, make(options));
1341 - }
1342 -}
1332 +>()("@t3tools/provider-acp/server/AcpSessionRuntime") {}
1333
1334 interface AcpStartedState extends AcpSessionRuntimeStartResult {}
1335
packages/provider-core/package.json
+4
@@ -99,6 +99,10 @@
99 "types": "./src/server/ProviderAdapter.ts",
100 "import": "./src/server/ProviderAdapter.ts"
101 },
102 + "./server/ProviderAuthFlow": {
103 + "types": "./src/server/ProviderAuthFlow.ts",
104 + "import": "./src/server/ProviderAuthFlow.ts"
105 + },
106 "./server/ProviderEventLoggers": {
107 "types": "./src/server/ProviderEventLoggers.ts",
108 "import": "./src/server/ProviderEventLoggers.ts"
packages/provider-core/src/server/ProviderAuthFlow.test.ts renamed
packages/provider-core/src/server/ProviderAuthFlow.ts renamed
+3 -5
@@ -21,7 +21,7 @@ import * as Semaphore from "effect/Semaphore";
21 import * as Stream from "effect/Stream";
22 import * as SubscriptionRef from "effect/SubscriptionRef";
23
24 -import type * as ProviderAuthService from "./ProviderAuthService.ts";
24 +import type * as ProviderAuth from "./auth.ts";
25
26 export interface ProviderAuthFlowContext {
27 readonly flowId: string;
@@ -61,9 +61,7 @@ interface Flow {
61 /** Adapters do login and credential handling; this owns client consent and flow lifetime. */
62 export const make = Effect.fn("ProviderAuthFlow.make")(function* (options: {
63 readonly instanceId: ProviderInstanceId;
64 - readonly credentialBinding: NonNullable<
65 - ProviderAuthService.ProviderAuthController["credentialBinding"]
66 - >;
64 + readonly credentialBinding: NonNullable<ProviderAuth.ProviderAuthController["credentialBinding"]>;
65 readonly methods: Effect.Effect<ReadonlyArray<ProviderAuthMethod>, ProviderSetupError>;
66 readonly defaultMethodId?: string;
67 /** Stored account profiles can change the advertised methods after auth/logout. */
@@ -145,7 +143,7 @@ export const make = Effect.fn("ProviderAuthFlow.make")(function* (options: {
143 );
144 yield* refreshMethods.pipe(Effect.forkIn(scope));
145
148 - const controller: ProviderAuthService.ProviderAuthController = {
146 + const controller: ProviderAuth.ProviderAuthController = {
147 credentialBinding: options.credentialBinding,
148 adoptCredentials: (update, stopSessions) =>
149 Effect.gen(function* () {
packages/provider-core/src/server/ProviderHost.ts
+4
@@ -49,6 +49,10 @@ interface ProviderHostService {
49 readonly paths: ProviderHostPaths;
50 readonly settings: {
51 readonly get: Effect.Effect<ServerSettings, ServerSettingsError>;
52 + /** Runs `use` on a settings snapshot that no settings write can change until it finishes. */
53 + readonly withSnapshot: <A, E, R>(
54 + use: (settings: ServerSettings) => Effect.Effect<A, E, R>,
55 + ) => Effect.Effect<A, E | ServerSettingsError, R>;
56 /** Every settings change after subscription, starting with the next one. */
57 readonly changes: Stream.Stream<ServerSettings>;
58 /** Changes buffered from the moment the scoped subscription is acquired. */
packages/provider-core/src/server/managedProvider.test.ts
+2
@@ -113,6 +113,7 @@ function layerProviderHost(input: {
113 },
114 settings: input.settings ?? {
115 get: Effect.succeed(DEFAULT_SERVER_SETTINGS),
116 + withSnapshot: (use) => use(DEFAULT_SERVER_SETTINGS),
117 changes: Stream.empty,
118 subscribe: Effect.succeed(Stream.empty),
119 },
@@ -285,6 +286,7 @@ describe("makeManagedServerProvider", () => {
286 const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>();
287 const hostSettings: ProviderHost.ProviderHost["Service"]["settings"] = {
288 get: Ref.get(serverSettingsRef),
289 + withSnapshot: (use) => Ref.get(serverSettingsRef).pipe(Effect.flatMap(use)),
290 changes: Stream.empty,
291 subscribe: PubSub.subscribe(serverSettingsChanges).pipe(
292 Effect.map((subscription) => Stream.fromSubscription(subscription)),
packages/provider-opencode/src/server/OpenCodeRuntime.ts
+6 -6
@@ -105,10 +105,10 @@ export class OpenCodeRuntimeError extends Data.TaggedError(OPENCODE_RUNTIME_ERRO
105 readonly operation: string;
106 readonly cause?: unknown;
107 readonly detail: string;
108 -}> {
109 - static readonly is = (u: unknown): u is OpenCodeRuntimeError =>
110 - P.isTagged(u, OPENCODE_RUNTIME_ERROR_TAG);
111 -}
108 +}> {}
109 +
110 +export const isOpenCodeRuntimeError = (u: unknown): u is OpenCodeRuntimeError =>
111 + P.isTagged(u, OPENCODE_RUNTIME_ERROR_TAG);
112
113 function encodeJsonStringForDiagnostics(input: unknown): string | undefined {
114 const result = encodeUnknownJsonStringExit(input);
@@ -116,7 +116,7 @@ function encodeJsonStringForDiagnostics(input: unknown): string | undefined {
116 }
117
118 export function openCodeRuntimeErrorDetail(cause: unknown): string {
119 - if (OpenCodeRuntimeError.is(cause)) return cause.detail;
119 + if (isOpenCodeRuntimeError(cause)) return cause.detail;
120 if (cause instanceof Error && cause.message.trim().length > 0) return cause.message.trim();
121 if (cause && typeof cause === "object") {
122 // SDK v2 throws { response, request, error? } shapes — extract what's useful
@@ -583,7 +583,7 @@ function ensureRuntimeError(
583 detail: string,
584 cause: unknown,
585 ): OpenCodeRuntimeError {
586 - return OpenCodeRuntimeError.is(cause)
586 + return isOpenCodeRuntimeError(cause)
587 ? cause
588 : new OpenCodeRuntimeError({ operation, detail, cause });
589 }
packages/provider-opencode/src/server/v2/OpenCode2Server.ts
+1 -1
@@ -123,7 +123,7 @@ export const verifyServer = (client: OpenCodeClient) =>
123 ),
124 }),
125 Effect.mapError((cause) =>
126 - OpenCodeRuntime.OpenCodeRuntimeError.is(cause)
126 + OpenCodeRuntime.isOpenCodeRuntimeError(cause)
127 ? cause
128 : new OpenCodeRuntime.OpenCodeRuntimeError({
129 operation: "server.info",
packages/provider-testing/src/host.ts
+24 -6
@@ -7,26 +7,38 @@
7 */
8 import { DEFAULT_SERVER_SETTINGS, type ServerSettings } from "@t3tools/contracts";
9 import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
10 +import * as Context from "effect/Context";
11 import * as Effect from "effect/Effect";
12 import * as FileSystem from "effect/FileSystem";
13 import * as Layer from "effect/Layer";
14 import * as Option from "effect/Option";
15 import * as Path from "effect/Path";
16 +import * as Ref from "effect/Ref";
17 import * as Stream from "effect/Stream";
18
19 export interface TestProviderHostOptions {
20 /** Session fallback cwd. Defaults to the test process cwd. */
21 readonly cwd?: string;
22 + /** Initial settings. A test changes them through `TestProviderHostSettings`. */
23 readonly settings?: ServerSettings;
24 /** Whether background work such as status probes may run. Defaults to `true`. */
25 readonly runBackgroundWork?: boolean;
26 }
27
28 +/** Lets a test change the settings its `layerTestProviderHost` reports. */
29 +export class TestProviderHostSettings extends Context.Service<
30 + TestProviderHostSettings,
31 + { readonly set: (settings: ServerSettings) => Effect.Effect<void> }
32 +>()("@t3tools/provider-testing/host/TestProviderHostSettings") {}
33 +
34 export const layerTestProviderHost = (
35 options: TestProviderHostOptions = {},
27 -): Layer.Layer<ProviderHost.ProviderHost, never, FileSystem.FileSystem | Path.Path> =>
28 - Layer.effect(
29 - ProviderHost.ProviderHost,
36 +): Layer.Layer<
37 + ProviderHost.ProviderHost | TestProviderHostSettings,
38 + never,
39 + FileSystem.FileSystem | Path.Path
40 +> =>
41 + Layer.effectContext(
42 Effect.gen(function* () {
43 const fileSystem = yield* FileSystem.FileSystem;
44 const path = yield* Path.Path;
@@ -39,9 +51,9 @@ export const layerTestProviderHost = (
51 for (const directory of [stateDir, providerStatusCacheDir, attachmentsDir]) {
52 yield* fileSystem.makeDirectory(directory, { recursive: true }).pipe(Effect.orDie);
53 }
42 - const settings = options.settings ?? DEFAULT_SERVER_SETTINGS;
54 + const settings = yield* Ref.make(options.settings ?? DEFAULT_SERVER_SETTINGS);
55 const credentials = new Map<string, Uint8Array>();
44 - return ProviderHost.ProviderHost.of({
56 + const host = ProviderHost.ProviderHost.of({
57 paths: {
58 cwd: options.cwd ?? process.cwd(),
59 baseDir,
@@ -50,7 +62,8 @@ export const layerTestProviderHost = (
62 attachmentsDir,
63 },
64 settings: {
53 - get: Effect.succeed(settings),
65 + get: Ref.get(settings),
66 + withSnapshot: (use) => Ref.get(settings).pipe(Effect.flatMap(use)),
67 changes: Stream.empty,
68 subscribe: Effect.succeed(Stream.empty),
69 },
@@ -69,5 +82,10 @@ export const layerTestProviderHost = (
82 };
83 }),
84 });
85 + return Context.make(ProviderHost.ProviderHost, host).pipe(
86 + Context.add(TestProviderHostSettings, {
87 + set: (next) => Ref.set(settings, next),
88 + }),
89 + );
90 }),
91 );
packages/shared/package.json
+4
@@ -470,6 +470,10 @@
470 "./mcpResponsePayloads": {
471 "types": "./src/mcpResponsePayloads.ts",
472 "import": "./src/mcpResponsePayloads.ts"
473 + },
474 + "./PtyAdapter": {
475 + "types": "./src/PtyAdapter.ts",
476 + "import": "./src/PtyAdapter.ts"
477 }
478 },
479 "scripts": {
packages/shared/src/PtyAdapter.ts renamed
+1 -1
@@ -63,4 +63,4 @@ export class PtyAdapter extends Context.Service<
63 */
64 readonly spawn: (input: PtySpawnInput) => Effect.Effect<PtyProcess, PtySpawnError>;
65 }
66 ->()("t3/terminal/PtyAdapter") {}
66 +>()("@t3tools/shared/PtyAdapter") {}
pnpm-lock.yaml
+49 -3
@@ -353,6 +353,9 @@ importers:
353 '@t3tools/mobile-terminal-native':
354 specifier: file:./modules/t3-terminal
355 version: file:apps/mobile/modules/t3-terminal
356 + '@t3tools/provider-acp-registry':
357 + specifier: workspace:*
358 + version: link:../../packages/provider-acp-registry
359 '@t3tools/provider-core':
360 specifier: workspace:*
361 version: link:../../packages/provider-core
@@ -597,15 +600,15 @@ importers:
600 '@napi-rs/keyring':
601 specifier: ^1.3.0
602 version: 1.3.0
600 - '@noble/hashes':
601 - specifier: 'catalog:'
602 - version: 1.8.0
603 '@opencode-ai/sdk':
604 specifier: ^1.3.15
605 version: 1.15.13
606 '@t3tools/provider-acp':
607 specifier: workspace:*
608 version: link:../../packages/provider-acp
609 + '@t3tools/provider-acp-registry':
610 + specifier: workspace:*
611 + version: link:../../packages/provider-acp-registry
612 '@t3tools/provider-core':
613 specifier: workspace:*
614 version: link:../../packages/provider-core
@@ -748,6 +751,9 @@ importers:
751 '@t3tools/contracts':
752 specifier: workspace:*
753 version: link:../../packages/contracts
754 + '@t3tools/provider-acp-registry':
755 + specifier: workspace:*
756 + version: link:../../packages/provider-acp-registry
757 '@t3tools/provider-core':
758 specifier: workspace:*
759 version: link:../../packages/provider-core
@@ -1138,6 +1144,46 @@ importers:
1144 specifier: 1.0.0
1145 version: 1.0.0(@types/node@24.12.4)(@vitest/ui@5.0.1(vitest@5.0.1))(bufferutil@4.1.0)(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1146
1147 + packages/provider-acp-registry:
1148 + dependencies:
1149 + '@noble/hashes':
1150 + specifier: 'catalog:'
1151 + version: 1.8.0
1152 + '@t3tools/contracts':
1153 + specifier: workspace:*
1154 + version: link:../contracts
1155 + '@t3tools/provider-acp':
1156 + specifier: workspace:*
1157 + version: link:../provider-acp
1158 + '@t3tools/provider-core':
1159 + specifier: workspace:*
1160 + version: link:../provider-core
1161 + '@t3tools/shared':
1162 + specifier: workspace:*
1163 + version: link:../shared
1164 + effect:
1165 + specifier: 4.0.1
1166 + version: 4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f)
1167 + devDependencies:
1168 + '@effect/platform-node':
1169 + specifier: 4.0.1
1170 + version: 4.0.1(bufferutil@4.1.0)(effect@4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))(redis@6.2.1)(utf-8-validate@6.0.6)
1171 + '@effect/vitest':
1172 + specifier: 4.0.1
1173 + version: 4.0.1(patch_hash=359f6fb2f7b3ec145bb72208edb9034f02489791aa2491a55cdbd69bd56ee0d2)(@types/node@24.12.4)(@vitest/ui@5.0.1)(bufferutil@4.1.0)(effect@4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1174 + '@t3tools/provider-testing':
1175 + specifier: workspace:*
1176 + version: link:../provider-testing
1177 + '@types/node':
1178 + specifier: 24.12.4
1179 + version: 24.12.4
1180 + effect-acp:
1181 + specifier: workspace:*
1182 + version: link:../effect-acp
1183 + vite-plus:
1184 + specifier: 1.0.0
1185 + version: 1.0.0(@types/node@24.12.4)(@vitest/ui@5.0.1(vitest@5.0.1))(bufferutil@4.1.0)(esbuild@0.28.2)(jiti@2.7.0)(jsdom@30.1.0(@noble/hashes@1.8.0))(msw@2.12.11(@types/node@24.12.4)(typescript@7.0.2))(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(utf-8-validate@6.0.6)(yaml@2.9.0)
1186 +
1187 packages/provider-core:
1188 dependencies:
1189 '@t3tools/contracts':
scripts/release-smoke.ts
+1
@@ -32,6 +32,7 @@ const workspaceFiles = [
32 "packages/provider-testing/package.json",
33 "packages/provider-pi/package.json",
34 "packages/provider-acp/package.json",
35 + "packages/provider-acp-registry/package.json",
36 "packages/provider-cursor/package.json",
37 "packages/provider-grok/package.json",
38 "packages/provider-muse/package.json",