@devries-cameron20 / t3code Mirror · read-only / commits / 7f1fa0d447
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 09:45 UTC

fix(acp): keep providers available after naming custom models (#37516)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 16, 2026 at 07:30 UTC 7f1fa0d4477cfe3a411da0fd5348a5df6702a381
3 files changed +29 -5
packages/provider-acp-registry/src/server/driver.test.ts
+23
@@ -9,6 +9,7 @@ import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
9 import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
10 import * as ProviderEventLoggers from "@t3tools/provider-core/server/ProviderEventLoggers";
11 import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost";
12 +import { toCustomModelSetting } from "@t3tools/shared/model";
13 import { AcpRegistrySettings } from "../settings.ts";
14 import { describe, expect, it } from "@effect/vitest";
15 import * as Effect from "effect/Effect";
@@ -102,6 +103,28 @@ function providerWithModels(
103 }
104
105 describe("acpRegistrySnapshotReadiness", () => {
106 + it("keeps the custom model display name and options saved by the Settings editor", () => {
107 + const fastMode = { id: "fast", label: "Fast mode", type: "boolean" } as const;
108 + const snapshot = buildCheckedAcpRegistrySnapshot({
109 + ...identity,
110 + settings: decodeSettings({
111 + agentId: "test-agent",
112 + customModels: [
113 + toCustomModelSetting({
114 + slug: "gateway/my-model",
115 + name: "My model",
116 + capabilities: { optionDescriptors: [fastMode] },
117 + }),
118 + ],
119 + }),
120 + checkedAt: "2026-08-13T10:00:00.000Z",
121 + inspection: { status: "ready", agentId: "test-agent", version: "1.0.0", distribution: "npx" },
122 + });
123 + const model = snapshot.models.find((entry) => entry.slug === "gateway/my-model");
124 + expect(model?.name).toBe("My model");
125 + expect(model?.capabilities?.optionDescriptors).toEqual([fastMode]);
126 + });
127 +
128 it("shows the version reported by a local ACP agent", () => {
129 const probe = acpRegistryProbeResult(identity.instanceId, {
130 sessionId: "test-session",
packages/provider-acp-registry/src/server/driver.ts
+4 -3
@@ -5,6 +5,7 @@ import {
5 TextGenerationError,
6 type AcpRegistryOperationError,
7 type AcpRegistryProbeModel,
8 + type CustomModelSetting,
9 type ServerProvider,
10 type ServerProviderModel,
11 } from "@t3tools/contracts";
@@ -97,7 +98,7 @@ export function isAcpRegistryCacheValid(
98 export function updateAcpRegistryEnrichmentCache(input: {
99 readonly cache: AcpRegistryEnrichmentCache;
100 readonly configuration: AcpRegistryLiveConfiguration;
100 - readonly customModels: ReadonlyArray<string>;
101 + readonly customModels: ReadonlyArray<CustomModelSetting>;
102 readonly now: number;
103 }): AcpRegistryEnrichmentCache {
104 const { cache, configuration, customModels, now } = input;
@@ -157,7 +158,7 @@ function modelsFromDiscovery(
158 "models" | "currentModelId" | "configOptions" | "modelOptionIds"
159 >
160 | undefined,
160 - customModels: ReadonlyArray<string>,
161 + customModels: ReadonlyArray<CustomModelSetting>,
162 previousModels: ReadonlyArray<ServerProviderModel> = [],
163 ): ReadonlyArray<ServerProviderModel> {
164 const discovered = discovery?.models ?? [];
@@ -349,7 +350,7 @@ export function applyAcpRegistryAvailableCommands(
350 export function applyAcpRegistryLiveConfiguration(
351 provider: ServerProvider,
352 configuration: AcpRegistryLiveConfiguration,
352 - customModels: ReadonlyArray<string>,
353 + customModels: ReadonlyArray<CustomModelSetting>,
354 previousModels: ReadonlyArray<ServerProviderModel> = provider.models,
355 ): ServerProvider {
356 const { message: _staleProbeMessage, ...snapshot } = provider;
packages/provider-acp-registry/src/settings.ts
+2 -2
@@ -1,4 +1,4 @@
1 -import { TrimmedString, makeProviderSettingsSchema } from "@t3tools/contracts";
1 +import { CustomModelSetting, TrimmedString, makeProviderSettingsSchema } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Schema from "effect/Schema";
4
@@ -58,7 +58,7 @@ export const AcpRegistrySettings = makeProviderSettingsSchema(
58 Schema.withDecodingDefault(Effect.succeed("auto")),
59 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
60 ),
61 - customModels: Schema.Array(Schema.String).pipe(
61 + customModels: Schema.Array(CustomModelSetting).pipe(
62 Schema.withDecodingDefault(Effect.succeed([])),
63 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
64 ),