Skip to content

Commit e30217d

Browse files
authored
refactor(providers): shared manifest row builder and fleet default-model adoption (#113879)
* feat(plugin-sdk): add manifest model row builder * refactor(providers): share manifest model row building * refactor(providers): source defaults from manifests * refactor(providers): drop unconsumed builder aliases * fix(providers): keep Cohere catalog internal
1 parent 5402ef1 commit e30217d

54 files changed

Lines changed: 277 additions & 342 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎extensions/baseten/api.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export {
55
BASETEN_DEFAULT_MODEL_REF,
66
BASETEN_MODEL_CATALOG,
77
buildBasetenModelCompat,
8-
buildBasetenModelDefinition,
98
buildStaticBasetenModels,
109
discoverBasetenModels,
1110
projectBasetenLiveModels,

‎extensions/baseten/models.ts‎

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
getCachedLiveProviderModelRows,
66
type LiveModelCatalogFetchGuard,
77
} from "openclaw/plugin-sdk/provider-catalog-live-runtime";
8-
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
8+
import {
9+
buildManifestModelDefinition,
10+
readManifestProviderDefaultModelRef,
11+
} from "openclaw/plugin-sdk/provider-catalog-shared";
912
import type {
1013
ModelCompatConfig,
1114
ModelDefinitionConfig,
@@ -49,9 +52,9 @@ const BASE_COMPAT: ModelCompatConfig = {
4952
/** Base URL for Baseten's OpenAI-compatible Model APIs. */
5053
export const BASETEN_BASE_URL = BASETEN_MANIFEST_CATALOG.baseUrl;
5154
/** Default Baseten model id used for onboarding. */
52-
export const BASETEN_DEFAULT_MODEL_ID = "thinkingmachines/inkling";
55+
export const BASETEN_DEFAULT_MODEL_ID = BASETEN_MANIFEST_CATALOG.defaultModel;
5356
/** Default Baseten model ref used for onboarding. */
54-
export const BASETEN_DEFAULT_MODEL_REF = `baseten/${BASETEN_DEFAULT_MODEL_ID}`;
57+
export const BASETEN_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(manifest, "baseten")!;
5558
/** Bundled fallback rows for all Baseten Model APIs available at release time. */
5659
export const BASETEN_MODEL_CATALOG = BASETEN_MANIFEST_CATALOG.models;
5760

@@ -110,27 +113,18 @@ export function buildBasetenModelCompat(modelId: string): ModelCompatConfig {
110113
};
111114
}
112115

113-
/** Builds one normalized Baseten model definition from a manifest entry. */
114-
export function buildBasetenModelDefinition(
115-
model: (typeof BASETEN_MODEL_CATALOG)[number],
116-
): ModelDefinitionConfig {
117-
const provider = buildManifestModelProviderConfig({
118-
providerId: "baseten",
119-
catalog: { ...BASETEN_MANIFEST_CATALOG, models: [model] },
120-
});
121-
const normalized = provider.models[0];
122-
if (!normalized) {
123-
throw new Error(`Missing normalized Baseten model ${model.id}`);
124-
}
125-
return {
126-
...normalized,
127-
compat: buildBasetenModelCompat(normalized.id),
128-
};
129-
}
130-
131116
/** Builds the network-free fallback catalog. */
132117
export function buildStaticBasetenModels(): ModelDefinitionConfig[] {
133-
return BASETEN_MODEL_CATALOG.map(buildBasetenModelDefinition);
118+
return BASETEN_MODEL_CATALOG.map(
119+
buildManifestModelDefinition({
120+
providerId: "baseten",
121+
catalog: BASETEN_MANIFEST_CATALOG,
122+
decorate: (normalized) => ({
123+
...normalized,
124+
compat: buildBasetenModelCompat(normalized.id),
125+
}),
126+
}),
127+
);
134128
}
135129

136130
type BasetenLiveModelRow = {

‎extensions/baseten/openclaw.plugin.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"baseten": {
2525
"baseUrl": "https://inference.baseten.co/v1",
2626
"api": "openai-completions",
27+
"defaultModel": "thinkingmachines/inkling",
2728
"models": [
2829
{
2930
"id": "deepseek-ai/DeepSeek-V4-Pro",

‎extensions/byteplus/api.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
export { buildBytePlusCodingProvider, buildBytePlusProvider } from "./provider-catalog.js";
55
export {
6-
buildBytePlusModelDefinition,
76
BYTEPLUS_BASE_URL,
87
BYTEPLUS_CODING_BASE_URL,
98
BYTEPLUS_CODING_MODEL_CATALOG,

‎extensions/byteplus/index.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { BYTEPLUS_CODING_MODEL_CATALOG, BYTEPLUS_MODEL_CATALOG } from "./models.
1010
describe("byteplus plugin", () => {
1111
it("augments the catalog with bundled standard and plan models", async () => {
1212
const provider = await registerSingleProviderPlugin(plugin);
13+
expect(provider.auth?.[0]?.starterModel).toBe("byteplus-plan/ark-code-latest");
1314
const standardModel = expectDefined(BYTEPLUS_MODEL_CATALOG[0], "BytePlus standard model");
1415
const codingModel = expectDefined(BYTEPLUS_CODING_MODEL_CATALOG[0], "BytePlus coding model");
1516
const entries = await provider.augmentModelCatalog?.({

‎extensions/byteplus/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
55
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
66
import { buildOpenAICompatibleLiveModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
7+
import { readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
78
import { ensureModelAllowlistEntry } from "openclaw/plugin-sdk/provider-onboard";
9+
import manifest from "./openclaw.plugin.json" with { type: "json" };
810
import { BYTEPLUS_PROVIDER_CATALOG_ENTRIES } from "./provider-catalog.js";
911
import { buildBytePlusVideoGenerationProvider } from "./video-generation-provider.js";
1012

1113
const PROVIDER_ID = "byteplus";
12-
const BYTEPLUS_DEFAULT_MODEL_REF = "byteplus-plan/ark-code-latest";
14+
const BYTEPLUS_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(manifest, "byteplus-plan")!;
1315

1416
export default definePluginEntry({
1517
id: PROVIDER_ID,

‎extensions/byteplus/models.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,3 @@ export const BYTEPLUS_MODEL_CATALOG: ModelDefinitionConfig[] = BYTEPLUS_MANIFEST
2525
/** BytePlus coding/planning model catalog entries. */
2626
export const BYTEPLUS_CODING_MODEL_CATALOG: ModelDefinitionConfig[] =
2727
BYTEPLUS_CODING_MANIFEST_PROVIDER.models;
28-
29-
/** Clones one manifest model definition so callers can mutate safely. */
30-
export function buildBytePlusModelDefinition(entry: ModelDefinitionConfig): ModelDefinitionConfig {
31-
return {
32-
...entry,
33-
input: [...entry.input],
34-
cost: { ...entry.cost },
35-
};
36-
}

‎extensions/byteplus/openclaw.plugin.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"byteplus-plan": {
115115
"baseUrl": "https://ark.ap-southeast.bytepluses.com/api/coding/v3",
116116
"api": "openai-completions",
117+
"defaultModel": "ark-code-latest",
117118
"models": [
118119
{
119120
"id": "ark-code-latest",

‎extensions/cerebras/api.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/**
22
* Public Cerebras provider plugin API exports.
33
*/
4-
export {
5-
buildCerebrasModelDefinition,
6-
CEREBRAS_BASE_URL,
7-
CEREBRAS_MODEL_CATALOG,
8-
} from "./models.js";
4+
export { buildCerebrasCatalogModels, CEREBRAS_BASE_URL, CEREBRAS_MODEL_CATALOG } from "./models.js";
95
export { buildCerebrasProvider } from "./provider-catalog.js";
106
export { applyCerebrasConfig, CEREBRAS_DEFAULT_MODEL_REF } from "./onboard.js";

‎extensions/cerebras/models.ts‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
* Cerebras model catalog helpers derived from the plugin manifest.
33
*/
4-
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
5-
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
4+
import { buildManifestModelDefinition } from "openclaw/plugin-sdk/provider-catalog-shared";
65
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
76
import manifest from "./openclaw.plugin.json" with { type: "json" };
87

@@ -15,19 +14,7 @@ export const CEREBRAS_MODEL_CATALOG = CEREBRAS_MANIFEST_CATALOG.models;
1514

1615
/** Builds normalized Cerebras catalog model definitions. */
1716
export function buildCerebrasCatalogModels(): ModelDefinitionConfig[] {
18-
return buildManifestModelProviderConfig({
19-
providerId: "cerebras",
20-
catalog: CEREBRAS_MANIFEST_CATALOG,
21-
}).models;
22-
}
23-
24-
/** Builds one normalized Cerebras model definition from a manifest entry. */
25-
export function buildCerebrasModelDefinition(
26-
model: (typeof CEREBRAS_MODEL_CATALOG)[number],
27-
): ModelDefinitionConfig {
28-
const providerConfig = buildManifestModelProviderConfig({
29-
providerId: "cerebras",
30-
catalog: { ...CEREBRAS_MANIFEST_CATALOG, models: [model] },
31-
});
32-
return expectDefined(providerConfig.models.at(0), "normalized Cerebras manifest model");
17+
return CEREBRAS_MODEL_CATALOG.map(
18+
buildManifestModelDefinition({ providerId: "cerebras", catalog: CEREBRAS_MANIFEST_CATALOG }),
19+
);
3320
}

0 commit comments

Comments
 (0)