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, 13:30 UTC
fix(acp-registry): models show the reasoning levels the agent advertises for them (#36950)
Co-authored-by: 0xpolarzero <0xpolarzero@gmail.com>
Julius Marminge committed
Nov 14, 2026 at 14:19 UTC
632802cd3243b204e6b17c47b3d7946beb312f21
4 files changed
+93
-5
packages/contracts/src/acpRegistry.ts
+2
@@ -268,6 +268,8 @@ export const AcpRegistryProbeModel = Schema.Struct({
268
id: AcpRegistryProbeText,
269
name: AcpRegistryProbeText,
270
description: AcpRegistryProbeDescription,
271
+ // The reasoning control the agent advertises for this model; null when it has none.
272
+ reasoningEffort: Schema.optionalKey(Schema.NullOr(ProviderOptionDescriptor)),
273
});
274
export type AcpRegistryProbeModel = typeof AcpRegistryProbeModel.Type;
275
packages/provider-acp-registry/src/server/driver.test.ts
+38
@@ -271,6 +271,44 @@ describe("acpRegistrySnapshotReadiness", () => {
271
expect(afterOpus.find((model) => model.slug === "opus")).toMatchObject({
272
capabilities: { optionDescriptors: [{ id: "thinking" }, { id: "mode" }] },
273
});
274
+
275
+ // Other models take the levels they advertise in `_meta`.
276
+ const effort = {
277
+ id: "effort",
278
+ name: "Effort",
279
+ category: "thought_level",
280
+ type: "select" as const,
281
+ currentValue: "high",
282
+ options: [{ value: "high", name: "High" }],
283
+ };
284
+ const advertised = applyAcpRegistryLiveConfiguration(
285
+ provider,
286
+ normalizeAcpRegistryLiveConfiguration([effort], undefined, {
287
+ currentModelId: "opus",
288
+ availableModels: [
289
+ { modelId: "opus", name: "Opus" },
290
+ {
291
+ modelId: "haiku",
292
+ name: "Haiku",
293
+ _meta: { reasoningEfforts: [{ value: "low", label: "Low" }], reasoningEffort: "low" },
294
+ },
295
+ { modelId: "glm", name: "GLM", _meta: { supportsReasoningEffort: false } },
296
+ ],
297
+ }),
298
+ [],
299
+ ).models.map((model) => model.capabilities?.optionDescriptors ?? []);
300
+ expect(advertised).toEqual([
301
+ [{ ...liveOptions[0]!, role: "reasoning" }],
302
+ [
303
+ {
304
+ ...liveOptions[0]!,
305
+ role: "reasoning",
306
+ options: [{ id: "low", label: "Low" }],
307
+ currentValue: "low",
308
+ },
309
+ ],
310
+ [],
311
+ ]);
312
});
313
314
it("projects discovery without claiming authentication when no login methods are advertised", () => {
packages/provider-acp-registry/src/server/driver.ts
+12
-4
@@ -4,6 +4,7 @@ import {
4
resolveOfficialAcpRegistryIconUrl,
5
TextGenerationError,
6
type AcpRegistryOperationError,
7
+ type AcpRegistryProbeModel,
8
type ServerProvider,
9
type ServerProviderModel,
10
} from "@t3tools/contracts";
@@ -111,12 +112,19 @@ function modelsFromDiscovery(
112
(descriptor) => !modelOptionIds.has(descriptor.id),
113
);
114
const sharedIds = new Set(shared.map((descriptor) => descriptor.id));
114
- const capabilitiesFor = (slug: string) => {
115
+ const capabilitiesFor = ({ id: slug, reasoningEffort }: AcpRegistryProbeModel) => {
116
if (slug === discovery?.currentModelId) return capabilities;
117
+ // The levels a model advertises replace the ones an earlier session reported.
118
const own = (
119
previousModels.find((model) => model.slug === slug)?.capabilities?.optionDescriptors ?? []
118
- ).filter((descriptor) => !sharedIds.has(descriptor.id));
119
- const optionDescriptors = [...shared, ...own];
120
+ ).filter(
121
+ (descriptor) =>
122
+ !sharedIds.has(descriptor.id) &&
123
+ (reasoningEffort === undefined ||
124
+ descriptor.type !== "select" ||
125
+ descriptor.role !== "reasoning"),
126
+ );
127
+ const optionDescriptors = [...shared, ...own, ...(reasoningEffort ? [reasoningEffort] : [])];
128
return optionDescriptors.length === 0
129
? EMPTY_CAPABILITIES
130
: createModelCapabilities({ optionDescriptors });
@@ -137,7 +145,7 @@ function modelsFromDiscovery(
145
name: model.name,
146
isCustom: false,
147
...(model.id === discovery?.currentModelId ? { isDefault: true } : {}),
140
- capabilities: capabilitiesFor(model.id),
148
+ capabilities: capabilitiesFor(model),
149
}));
150
return providerModelsFromSettings(builtInModels, customModels, capabilities);
151
}
packages/provider-acp-registry/src/server/probe.ts
+41
-1
@@ -53,6 +53,39 @@ const boundedText = (value: string, maximumLength: number): string =>
53
const boundedOpaqueValue = (value: string, maximumLength: number): string | undefined =>
54
value.length > 0 && value === value.trim() && value.length <= maximumLength ? value : undefined;
55
56
+/**
57
+ * The session's reasoning option with the levels a model advertises in `_meta`, in the
58
+ * shape Grok uses. Null when the model has none, undefined when it says nothing.
59
+ */
60
+function advertisedReasoningEffort(
61
+ option: EffectAcpSchema.SessionConfigOption | undefined,
62
+ meta: Readonly<Record<string, unknown>> | null | undefined,
63
+): AcpRegistryProbeModel["reasoningEffort"] {
64
+ if (option?.type !== "select" || meta == null) return undefined;
65
+ if (meta.supportsReasoningEffort === false) return null;
66
+ if (!Array.isArray(meta.reasoningEfforts)) return undefined;
67
+ const options = meta.reasoningEfforts.flatMap((level: unknown) =>
68
+ typeof level === "object" &&
69
+ level !== null &&
70
+ "value" in level &&
71
+ typeof level.value === "string"
72
+ ? [
73
+ {
74
+ value: level.value,
75
+ name: "label" in level && typeof level.label === "string" ? level.label : level.value,
76
+ },
77
+ ]
78
+ : [],
79
+ );
80
+ const currentValue = typeof meta.reasoningEffort === "string" ? meta.reasoningEffort : "";
81
+ return (
82
+ acpProviderOptionDescriptors({
83
+ configOptions: [{ ...option, options, currentValue }],
84
+ modeState: undefined,
85
+ })[0] ?? null
86
+ );
87
+}
88
+
89
export function normalizeAcpRegistryWebUrl(value: string): string | undefined {
90
if (value.length > 2_048 || !URL.canParse(value)) return undefined;
91
const url = new URL(value);
@@ -195,7 +228,14 @@ export function normalizeAcpRegistryLiveConfiguration(
228
currentModelId === undefined
229
? null
230
: (boundedOpaqueValue(currentModelId, MAX_ID_LENGTH) ?? null);
198
- const models = normalizeModels(candidates, boundedCurrentModelId);
231
+ const effortOption = configOptions.find((option) => option.category === "thought_level");
232
+ const models = normalizeModels(candidates, boundedCurrentModelId).map((model) => {
233
+ const reasoningEffort = advertisedReasoningEffort(
234
+ effortOption,
235
+ modelState?.availableModels.find((info) => info.modelId === model.id)?._meta,
236
+ );
237
+ return reasoningEffort === undefined ? model : { ...model, reasoningEffort };
238
+ });
239
const descriptors = acpProviderOptionDescriptors({ configOptions, modeState });
240
const modelOptionIds = new Set(
241
configOptions