Skip to content

Commit f355acb

Browse files
committed
fix(provider-acp-registry): apply live option controls to kept models
1 parent 9cd8cab commit f355acb

2 files changed

Lines changed: 40 additions & 3 deletions

File tree

‎packages/provider-acp-registry/src/server/driver.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,29 @@ describe("acpRegistrySnapshotReadiness", () => {
211211
[],
212212
).models,
213213
).toEqual(provider.models);
214+
215+
const liveOptions = [
216+
{
217+
id: "effort",
218+
label: "Effort",
219+
type: "select" as const,
220+
options: [{ id: "high", label: "High" }],
221+
currentValue: "high",
222+
},
223+
];
224+
expect(
225+
applyAcpRegistryLiveConfiguration(
226+
provider,
227+
{ models: [], currentModelId: null, configOptions: liveOptions },
228+
[],
229+
).models,
230+
).toMatchObject([
231+
{
232+
slug: "probe-model",
233+
isDefault: true,
234+
capabilities: { optionDescriptors: [{ id: "effort", currentValue: "high" }] },
235+
},
236+
]);
214237
});
215238

216239
it("projects discovery without claiming authentication when no login methods are advertised", () => {

‎packages/provider-acp-registry/src/server/driver.ts‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,28 @@ export function applyAcpRegistryLiveConfiguration(
258258
customModels: ReadonlyArray<string>,
259259
): ServerProvider {
260260
const { message: _staleProbeMessage, ...snapshot } = provider;
261+
// session/load may omit models (Kimi returns `{}`); keep the probed list
262+
// and apply any live option descriptors to it.
263+
const probedModels = provider.models.filter((model) => !model.isCustom);
264+
const discovery =
265+
configuration.models.length > 0
266+
? configuration
267+
: {
268+
...configuration,
269+
models: probedModels.map((model) => ({
270+
id: model.slug,
271+
name: model.name,
272+
description: null,
273+
})),
274+
currentModelId: probedModels.find((model) => model.isDefault)?.slug ?? null,
275+
};
261276
return {
262277
...snapshot,
263278
status: provider.enabled ? "ready" : provider.status,
264-
// session/load may omit models (Kimi returns `{}`); keep the probed list.
265279
models:
266-
configuration.models.length === 0
280+
configuration.models.length === 0 && configuration.configOptions.length === 0
267281
? provider.models
268-
: modelsFromDiscovery(configuration, customModels),
282+
: modelsFromDiscovery(discovery, customModels),
269283
};
270284
}
271285

0 commit comments

Comments
 (0)