@agent-native/core 0.237.2-nightly-20261202183703 → 0.237.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/actions/describe-models.js +22 -2
- package/dist/agent/actions/get-provider-models.js +7 -4
- package/dist/agent/actions/manage-provider-models.js +4 -2
- package/dist/agent/builder-gateway-models.d.ts +52 -0
- package/dist/agent/builder-gateway-models.js +180 -0
- package/dist/agent/engine/anthropic-engine.d.ts +1 -1
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/engine/builder-engine.js +4 -1
- package/dist/agent/engine/builtin.js +5 -2
- package/dist/agent/model-catalog.d.ts +1 -1
- package/dist/agent/model-catalog.js +33 -9
- package/dist/agent/model-config.d.ts +10 -10
- package/dist/agent/model-config.js +29 -12
- package/dist/agent/production-agent.js +7 -0
- package/dist/agent/provider-model-selection.d.ts +6 -0
- package/dist/agent/provider-model-selection.js +28 -13
- package/dist/framework-package-versions.json +13 -13
- package/dist/provider-api/actions/provider-api.d.ts +2 -2
- package/dist/scripts/agent-engines/list-agent-engines.js +26 -10
- package/dist/scripts/agent-engines/manage-agent-engine.js +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js +4 -0
- package/dist/server/agent-chat-plugin.js +7 -0
- package/dist/server/agent-engine-api-key-route.d.ts +2 -2
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/usage/store.js +32 -0
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineAction, fail } from "../../action.js";
|
|
3
3
|
import { REASONING_EFFORTS } from "../../shared/reasoning-effort.js";
|
|
4
|
+
import { readBuilderGatewayModels, } from "../builder-gateway-models.js";
|
|
4
5
|
import { registerBuiltinEngines } from "../engine/builtin.js";
|
|
5
6
|
import { getAgentEngineEntry } from "../engine/registry.js";
|
|
6
7
|
import { describeModelForEngine, MODEL_CATALOG, MODEL_DESCRIPTORS, MODEL_PROVIDERS, } from "../model-catalog.js";
|
|
@@ -80,6 +81,7 @@ export default defineAction({
|
|
|
80
81
|
mcpTool: false,
|
|
81
82
|
run: async (args) => {
|
|
82
83
|
let modelIds = args.models;
|
|
84
|
+
let builderCatalog;
|
|
83
85
|
if (!modelIds && args.engine) {
|
|
84
86
|
registerBuiltinEngines();
|
|
85
87
|
const entry = getAgentEngineEntry(args.engine);
|
|
@@ -89,12 +91,24 @@ export default defineAction({
|
|
|
89
91
|
statusCode: 404,
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
if (args.engine === "builder") {
|
|
95
|
+
builderCatalog = await readBuilderGatewayModels();
|
|
96
|
+
modelIds =
|
|
97
|
+
builderCatalog.state === "available"
|
|
98
|
+
? [...builderCatalog.modelIds]
|
|
99
|
+
: [...entry.supportedModels];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
modelIds = [...entry.supportedModels];
|
|
103
|
+
}
|
|
93
104
|
}
|
|
94
105
|
const metadata = args.engine && LIVE_METADATA_ENGINES.has(args.engine)
|
|
95
106
|
? await readAnthropicModelMetadata()
|
|
96
107
|
: undefined;
|
|
97
108
|
const live = metadata?.state === "available" ? metadata.models : undefined;
|
|
109
|
+
const builderDisplayNames = builderCatalog?.state === "available"
|
|
110
|
+
? builderCatalog.displayNames
|
|
111
|
+
: undefined;
|
|
98
112
|
const ids = modelIds ?? MODEL_CATALOG.map((entry) => entry.id);
|
|
99
113
|
// A key can reach models the static list does not name; describe those
|
|
100
114
|
// too, so the picker can show their real window and levels.
|
|
@@ -110,7 +124,13 @@ export default defineAction({
|
|
|
110
124
|
...(metadata.status ? { status: metadata.status } : {}),
|
|
111
125
|
}
|
|
112
126
|
: { state: "not-applicable" },
|
|
113
|
-
models: allIds.map((id) =>
|
|
127
|
+
models: allIds.map((id) => {
|
|
128
|
+
const description = describeModelForEngine(id, args.engine, live?.[id]);
|
|
129
|
+
if (!description.name && builderDisplayNames?.[id]) {
|
|
130
|
+
return { ...description, name: builderDisplayNames[id] };
|
|
131
|
+
}
|
|
132
|
+
return description;
|
|
133
|
+
}),
|
|
114
134
|
};
|
|
115
135
|
},
|
|
116
136
|
});
|
|
@@ -3,7 +3,7 @@ import { defineAction, fail } from "../../action.js";
|
|
|
3
3
|
import { AGENT_PROVIDER_CATALOG } from "../../client/agent-provider-catalog.js";
|
|
4
4
|
import { getOrgRoleForEmail } from "../../mcp/actions/service-token-access.js";
|
|
5
5
|
import { canManageOrg } from "../../org/permissions.js";
|
|
6
|
-
import { PROVIDER_MODEL_SELECTION_PROVIDERS, ProviderModelSelectionError, readProviderModelSelection,
|
|
6
|
+
import { PROVIDER_MODEL_SELECTION_PROVIDERS, ProviderModelSelectionError, readProviderModelSelection, recommendedProviderModelsAsync, resolveEffectiveProviderModelSelection, } from "../provider-model-selection.js";
|
|
7
7
|
function providerLabel(provider) {
|
|
8
8
|
if (provider === "builder")
|
|
9
9
|
return "Builder.io";
|
|
@@ -42,7 +42,10 @@ export default defineAction({
|
|
|
42
42
|
const providers = (args.provider ? [args.provider] : PROVIDER_MODEL_SELECTION_PROVIDERS);
|
|
43
43
|
try {
|
|
44
44
|
const entries = await Promise.all(providers.map(async (provider) => {
|
|
45
|
-
const effective = await
|
|
45
|
+
const [effective, recommended] = await Promise.all([
|
|
46
|
+
resolveEffectiveProviderModelSelection(provider, selectionCtx),
|
|
47
|
+
recommendedProviderModelsAsync(provider),
|
|
48
|
+
]);
|
|
46
49
|
const rows = {};
|
|
47
50
|
for (const scope of scopes) {
|
|
48
51
|
rows[scope] = await readProviderModelSelection(selectionCtx, provider, scope);
|
|
@@ -50,14 +53,14 @@ export default defineAction({
|
|
|
50
53
|
return {
|
|
51
54
|
provider,
|
|
52
55
|
label: providerLabel(provider),
|
|
53
|
-
recommendedModels: [...
|
|
56
|
+
recommendedModels: [...recommended],
|
|
54
57
|
state: effective.state,
|
|
55
58
|
...(effective.state === "unreadable"
|
|
56
59
|
? { error: effective.error }
|
|
57
60
|
: { scope: effective.scope }),
|
|
58
61
|
models: effective.state === "selected"
|
|
59
62
|
? effective.models
|
|
60
|
-
: [...
|
|
63
|
+
: [...recommended],
|
|
61
64
|
rows,
|
|
62
65
|
};
|
|
63
66
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineAction, fail } from "../../action.js";
|
|
3
3
|
import { orgAdminAuditTarget } from "../../audit/org-admin.js";
|
|
4
|
-
import { MAX_SELECTED_MODELS, PROVIDER_MODEL_SELECTION_AUDIT_TARGET_TYPE, PROVIDER_MODEL_SELECTION_PROVIDERS, ProviderModelSelectionError,
|
|
4
|
+
import { MAX_SELECTED_MODELS, PROVIDER_MODEL_SELECTION_AUDIT_TARGET_TYPE, PROVIDER_MODEL_SELECTION_PROVIDERS, ProviderModelSelectionError, recommendedProviderModelsAsync, resetProviderModelSelection, resolveProviderModelSelectionScope, writeProviderModelSelection, } from "../provider-model-selection.js";
|
|
5
5
|
function auditScope(args, result) {
|
|
6
6
|
return result?.scope ?? args.scope;
|
|
7
7
|
}
|
|
@@ -62,7 +62,9 @@ export default defineAction({
|
|
|
62
62
|
: await resetProviderModelSelection(selectionCtx, provider, scope);
|
|
63
63
|
return {
|
|
64
64
|
...row,
|
|
65
|
-
recommendedModels: [
|
|
65
|
+
recommendedModels: [
|
|
66
|
+
...(await recommendedProviderModelsAsync(provider)),
|
|
67
|
+
],
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
70
|
catch (err) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** One model advertised by the Builder LLM gateway's `/discover` endpoint. */
|
|
2
|
+
export interface BuilderGatewayDiscoveredModel {
|
|
3
|
+
publicId: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
provider?: string;
|
|
6
|
+
notes?: string;
|
|
7
|
+
}
|
|
8
|
+
export type BuilderGatewayModelsUnavailableReason = "unreachable" | "gateway-error" | "invalid-response";
|
|
9
|
+
export type BuilderGatewayModelsResult = {
|
|
10
|
+
state: "available";
|
|
11
|
+
fetchedAt: number;
|
|
12
|
+
models: readonly BuilderGatewayDiscoveredModel[];
|
|
13
|
+
modelIds: readonly string[];
|
|
14
|
+
displayNames: Readonly<Record<string, string>>;
|
|
15
|
+
} | {
|
|
16
|
+
state: "unavailable";
|
|
17
|
+
reason: BuilderGatewayModelsUnavailableReason;
|
|
18
|
+
status?: number;
|
|
19
|
+
};
|
|
20
|
+
export interface ReadBuilderGatewayModelsOptions {
|
|
21
|
+
fetchImpl?: typeof fetch;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Parse `GET /discover`'s JSON payload; exported for specs. */
|
|
26
|
+
export declare function parseBuilderGatewayDiscoverResponse(body: unknown): BuilderGatewayDiscoveredModel[] | null;
|
|
27
|
+
/**
|
|
28
|
+
* Read the Builder LLM gateway's live model catalog from `GET /discover`.
|
|
29
|
+
*
|
|
30
|
+
* Results are cached in memory per gateway base URL (1 hour on success,
|
|
31
|
+
* 1 minute on failure). Never runs at module load.
|
|
32
|
+
*/
|
|
33
|
+
export declare function readBuilderGatewayModels(options?: ReadBuilderGatewayModelsOptions): Promise<BuilderGatewayModelsResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Synchronously return the last live-discovered Builder gateway model list, or
|
|
36
|
+
* the bundled fallback list when discovery has not yet succeeded in this process.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getCachedBuilderSupportedModels(baseUrl?: string): readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the Builder gateway's supported model IDs, falling back to the
|
|
41
|
+
* bundled `BUILDER_MODEL_CONFIG.supportedModels` when the gateway is
|
|
42
|
+
* unreachable.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveBuilderSupportedModels(options?: ReadBuilderGatewayModelsOptions): Promise<readonly string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Warm the live Builder gateway catalog only when `model` is not already in the
|
|
47
|
+
* cached/bundled list, so cold runtimes recognize newly launched gateway models
|
|
48
|
+
* without adding latency for known ones.
|
|
49
|
+
*/
|
|
50
|
+
export declare function ensureBuilderModelKnown(model: string | null | undefined, options?: ReadBuilderGatewayModelsOptions): Promise<readonly string[]>;
|
|
51
|
+
/** Clear cached gateway discovery results. Tests only. */
|
|
52
|
+
export declare function __resetBuilderGatewayModelsCache(): void;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { getBuilderGatewayBaseUrl } from "../server/credential-provider.js";
|
|
2
|
+
import { BUILDER_MODEL_CONFIG } from "./model-config.js";
|
|
3
|
+
const DEFAULT_BUILDER_GATEWAY_BASE_URL = "https://api.builder.io/agent-native/gateway/v1";
|
|
4
|
+
const AVAILABLE_TTL_MS = 60 * 60 * 1000;
|
|
5
|
+
const UNAVAILABLE_TTL_MS = 60 * 1000;
|
|
6
|
+
const REQUEST_TIMEOUT_MS = 5_000;
|
|
7
|
+
const MAX_MODEL_ID_LENGTH = 128;
|
|
8
|
+
const cache = new Map();
|
|
9
|
+
const lastKnownAvailable = new Map();
|
|
10
|
+
function isRecord(value) {
|
|
11
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
function normalizeBaseUrl(raw) {
|
|
14
|
+
return raw.trim().replace(/\/+$/, "");
|
|
15
|
+
}
|
|
16
|
+
function resolveGatewayBaseUrl(explicit) {
|
|
17
|
+
if (explicit?.trim())
|
|
18
|
+
return normalizeBaseUrl(explicit);
|
|
19
|
+
return normalizeBaseUrl(getBuilderGatewayBaseUrl() || DEFAULT_BUILDER_GATEWAY_BASE_URL);
|
|
20
|
+
}
|
|
21
|
+
function isTestRuntime() {
|
|
22
|
+
return process.env.NODE_ENV === "test";
|
|
23
|
+
}
|
|
24
|
+
function isValidModelId(id) {
|
|
25
|
+
return (id.length > 0 && id.length <= MAX_MODEL_ID_LENGTH && !/[\s\p{Cc}]/u.test(id));
|
|
26
|
+
}
|
|
27
|
+
/** Parse `GET /discover`'s JSON payload; exported for specs. */
|
|
28
|
+
export function parseBuilderGatewayDiscoverResponse(body) {
|
|
29
|
+
if (!isRecord(body) || !Array.isArray(body["models"]))
|
|
30
|
+
return null;
|
|
31
|
+
const seen = new Set();
|
|
32
|
+
const models = [];
|
|
33
|
+
for (const entry of body["models"]) {
|
|
34
|
+
if (!isRecord(entry) || typeof entry["publicId"] !== "string")
|
|
35
|
+
continue;
|
|
36
|
+
const publicId = entry["publicId"].trim();
|
|
37
|
+
if (!isValidModelId(publicId) || seen.has(publicId))
|
|
38
|
+
continue;
|
|
39
|
+
seen.add(publicId);
|
|
40
|
+
const label = typeof entry["label"] === "string" && entry["label"].trim()
|
|
41
|
+
? entry["label"].trim()
|
|
42
|
+
: undefined;
|
|
43
|
+
const provider = typeof entry["provider"] === "string" && entry["provider"].trim()
|
|
44
|
+
? entry["provider"].trim()
|
|
45
|
+
: undefined;
|
|
46
|
+
const notes = typeof entry["notes"] === "string" && entry["notes"].trim()
|
|
47
|
+
? entry["notes"].trim()
|
|
48
|
+
: undefined;
|
|
49
|
+
models.push({
|
|
50
|
+
publicId,
|
|
51
|
+
...(label ? { label } : {}),
|
|
52
|
+
...(provider ? { provider } : {}),
|
|
53
|
+
...(notes ? { notes } : {}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return models.length > 0 ? models : null;
|
|
57
|
+
}
|
|
58
|
+
async function fetchBuilderGatewayModels(baseUrl, fetchImpl, now) {
|
|
59
|
+
const url = `${baseUrl}/discover`;
|
|
60
|
+
let response;
|
|
61
|
+
try {
|
|
62
|
+
response = await fetchImpl(url, {
|
|
63
|
+
headers: { Accept: "application/json" },
|
|
64
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return { state: "unavailable", reason: "unreachable" };
|
|
69
|
+
}
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
return {
|
|
72
|
+
state: "unavailable",
|
|
73
|
+
reason: "gateway-error",
|
|
74
|
+
status: response.status,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
let body;
|
|
78
|
+
try {
|
|
79
|
+
body = await response.json();
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return { state: "unavailable", reason: "invalid-response" };
|
|
83
|
+
}
|
|
84
|
+
const models = parseBuilderGatewayDiscoverResponse(body);
|
|
85
|
+
if (!models) {
|
|
86
|
+
return { state: "unavailable", reason: "invalid-response" };
|
|
87
|
+
}
|
|
88
|
+
const modelIds = models.map((model) => model.publicId);
|
|
89
|
+
const displayNames = {};
|
|
90
|
+
for (const model of models) {
|
|
91
|
+
if (model.label)
|
|
92
|
+
displayNames[model.publicId] = model.label;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
state: "available",
|
|
96
|
+
fetchedAt: now(),
|
|
97
|
+
models,
|
|
98
|
+
modelIds,
|
|
99
|
+
displayNames,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Read the Builder LLM gateway's live model catalog from `GET /discover`.
|
|
104
|
+
*
|
|
105
|
+
* Results are cached in memory per gateway base URL (1 hour on success,
|
|
106
|
+
* 1 minute on failure). Never runs at module load.
|
|
107
|
+
*/
|
|
108
|
+
export async function readBuilderGatewayModels(options = {}) {
|
|
109
|
+
const baseUrl = resolveGatewayBaseUrl(options.baseUrl);
|
|
110
|
+
if (isTestRuntime() &&
|
|
111
|
+
!options.fetchImpl &&
|
|
112
|
+
!options.baseUrl &&
|
|
113
|
+
baseUrl === DEFAULT_BUILDER_GATEWAY_BASE_URL) {
|
|
114
|
+
return { state: "unavailable", reason: "unreachable" };
|
|
115
|
+
}
|
|
116
|
+
const now = options.now ?? Date.now;
|
|
117
|
+
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
118
|
+
const currentTime = now();
|
|
119
|
+
const existing = cache.get(baseUrl);
|
|
120
|
+
if (existing && existing.expiresAt > currentTime) {
|
|
121
|
+
return existing.result;
|
|
122
|
+
}
|
|
123
|
+
const pending = fetchBuilderGatewayModels(baseUrl, fetchImpl, now).then((result) => {
|
|
124
|
+
if (result.state === "available") {
|
|
125
|
+
lastKnownAvailable.set(baseUrl, result);
|
|
126
|
+
}
|
|
127
|
+
const current = cache.get(baseUrl);
|
|
128
|
+
if (current?.result === pending) {
|
|
129
|
+
current.expiresAt =
|
|
130
|
+
now() +
|
|
131
|
+
(result.state === "available"
|
|
132
|
+
? AVAILABLE_TTL_MS
|
|
133
|
+
: UNAVAILABLE_TTL_MS);
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
});
|
|
137
|
+
cache.set(baseUrl, {
|
|
138
|
+
expiresAt: currentTime + UNAVAILABLE_TTL_MS,
|
|
139
|
+
result: pending,
|
|
140
|
+
});
|
|
141
|
+
return pending;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Synchronously return the last live-discovered Builder gateway model list, or
|
|
145
|
+
* the bundled fallback list when discovery has not yet succeeded in this process.
|
|
146
|
+
*/
|
|
147
|
+
export function getCachedBuilderSupportedModels(baseUrl) {
|
|
148
|
+
const key = resolveGatewayBaseUrl(baseUrl);
|
|
149
|
+
return (lastKnownAvailable.get(key)?.modelIds ??
|
|
150
|
+
BUILDER_MODEL_CONFIG.supportedModels);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolve the Builder gateway's supported model IDs, falling back to the
|
|
154
|
+
* bundled `BUILDER_MODEL_CONFIG.supportedModels` when the gateway is
|
|
155
|
+
* unreachable.
|
|
156
|
+
*/
|
|
157
|
+
export async function resolveBuilderSupportedModels(options = {}) {
|
|
158
|
+
const result = await readBuilderGatewayModels(options);
|
|
159
|
+
return result.state === "available"
|
|
160
|
+
? result.modelIds
|
|
161
|
+
: getCachedBuilderSupportedModels(options.baseUrl);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Warm the live Builder gateway catalog only when `model` is not already in the
|
|
165
|
+
* cached/bundled list, so cold runtimes recognize newly launched gateway models
|
|
166
|
+
* without adding latency for known ones.
|
|
167
|
+
*/
|
|
168
|
+
export async function ensureBuilderModelKnown(model, options = {}) {
|
|
169
|
+
const cached = getCachedBuilderSupportedModels(options.baseUrl);
|
|
170
|
+
const candidate = typeof model === "string" ? model.trim() : "";
|
|
171
|
+
if (!candidate || candidate === "auto" || cached.includes(candidate)) {
|
|
172
|
+
return cached;
|
|
173
|
+
}
|
|
174
|
+
return resolveBuilderSupportedModels(options);
|
|
175
|
+
}
|
|
176
|
+
/** Clear cached gateway discovery results. Tests only. */
|
|
177
|
+
export function __resetBuilderGatewayModelsCache() {
|
|
178
|
+
cache.clear();
|
|
179
|
+
lastKnownAvailable.clear();
|
|
180
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentEngine, EngineCapabilities } from "./types.js";
|
|
2
2
|
export declare const ANTHROPIC_CAPABILITIES: EngineCapabilities;
|
|
3
|
-
export declare const ANTHROPIC_SUPPORTED_MODELS: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-1", "claude-fable-5"];
|
|
3
|
+
export declare const ANTHROPIC_SUPPORTED_MODELS: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-2", "claude-fable-5-1", "claude-fable-5"];
|
|
4
4
|
export declare const ANTHROPIC_DEFAULT_MODEL: "claude-sonnet-5-5";
|
|
5
5
|
export declare function createAnthropicEngine(config?: Record<string, unknown>): AgentEngine;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BuilderGatewayLane } from "../../server/credential-provider.js";
|
|
2
2
|
import type { AgentEngine, EngineCapabilities } from "./types.js";
|
|
3
3
|
export declare const BUILDER_CAPABILITIES: EngineCapabilities;
|
|
4
|
-
export declare const BUILDER_SUPPORTED_MODELS: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-
|
|
4
|
+
export declare const BUILDER_SUPPORTED_MODELS: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-6-2-sol", "gpt-6-1-terra", "gpt-6-luna", "gemini-4-hydrogen", "gemini-4-neon", "gemini-4-argon", "gemini-4-carbon", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
5
5
|
export declare const BUILDER_MODEL_UNAUTHORIZED_ERROR_CODE = "builder_model_unauthorized";
|
|
6
6
|
/**
|
|
7
7
|
* A truncated stream, not a rejected request: the client continues the partial
|
|
@@ -6,6 +6,7 @@ import { getRequestOrgId, getRequestRunContext, getRequestUserEmail, } from "../
|
|
|
6
6
|
import { builderSubscriptionUpgradeUrl } from "../../shared/builder-link-tracking.js";
|
|
7
7
|
import { allowsSamplingParams, normalizeReasoningEffortForModel, } from "../../shared/reasoning-effort.js";
|
|
8
8
|
import { clearBuilderCreditLimitNotice, sendBuilderCreditLimitNotice, } from "../../usage/builder-credit-notice.js";
|
|
9
|
+
import { getCachedBuilderSupportedModels } from "../builder-gateway-models.js";
|
|
9
10
|
import { isInBackgroundFunctionRuntime } from "../durable-background.js";
|
|
10
11
|
import { BUILDER_MODEL_CONFIG } from "../model-config.js";
|
|
11
12
|
import { getBuilderGatewayRequestHeaders } from "./builder-gateway-headers.js";
|
|
@@ -105,7 +106,9 @@ class BuilderEngine {
|
|
|
105
106
|
name = "builder";
|
|
106
107
|
label = "Builder.io Gateway";
|
|
107
108
|
defaultModel = BUILDER_DEFAULT_MODEL;
|
|
108
|
-
supportedModels
|
|
109
|
+
get supportedModels() {
|
|
110
|
+
return getCachedBuilderSupportedModels();
|
|
111
|
+
}
|
|
109
112
|
capabilities = BUILDER_CAPABILITIES;
|
|
110
113
|
supportsPrivateContent = true;
|
|
111
114
|
constructor(configuredCredentials) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AppConfigurationError, getAppConfig } from "../../app-config/index.js";
|
|
2
2
|
import { CHATGPT_SUBSCRIPTION_LAB } from "../../labs/core-labs.js";
|
|
3
3
|
import { registerLabs } from "../../labs/registry.js";
|
|
4
|
+
import { getCachedBuilderSupportedModels } from "../builder-gateway-models.js";
|
|
4
5
|
import { CHATGPT_SUBSCRIPTION_ENGINE_NAME } from "../chatgpt-subscription-contract.js";
|
|
5
6
|
import { createAISDKEngine, PROVIDER_CAPABILITIES, PROVIDER_DEFAULT_MODELS, PROVIDER_SUPPORTED_MODELS, PROVIDER_ENV_VARS, PROVIDER_PACKAGES, } from "./ai-sdk-engine.js";
|
|
6
7
|
import { createAnthropicEngine, ANTHROPIC_CAPABILITIES, ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_SUPPORTED_MODELS, } from "./anthropic-engine.js";
|
|
7
|
-
import { createBuilderEngine, BUILDER_CAPABILITIES, BUILDER_DEFAULT_MODEL,
|
|
8
|
+
import { createBuilderEngine, BUILDER_CAPABILITIES, BUILDER_DEFAULT_MODEL, } from "./builder-engine.js";
|
|
8
9
|
import { createChatGPTSubscriptionEngine } from "./chatgpt-subscription-engine.js";
|
|
9
10
|
import { registerAgentEngine, unregisterAgentEngine, } from "./registry.js";
|
|
10
11
|
const aiSdkProviders = [
|
|
@@ -45,7 +46,9 @@ function builtinEngineEntries() {
|
|
|
45
46
|
description: "Managed LLM access via Builder.io — Claude, GPT, Gemini, and more through a single connection.",
|
|
46
47
|
capabilities: BUILDER_CAPABILITIES,
|
|
47
48
|
defaultModel: BUILDER_DEFAULT_MODEL,
|
|
48
|
-
supportedModels
|
|
49
|
+
get supportedModels() {
|
|
50
|
+
return getCachedBuilderSupportedModels();
|
|
51
|
+
},
|
|
49
52
|
requiredEnvVars: ["BUILDER_PRIVATE_KEY", "BUILDER_PUBLIC_KEY"],
|
|
50
53
|
alternateRequiredEnvVars: [
|
|
51
54
|
{
|
|
@@ -62,7 +62,7 @@ export declare function canonicalModelId(modelId: string): string;
|
|
|
62
62
|
* models. A model the engine doesn't offer is skipped, and an engine offering
|
|
63
63
|
* none of these falls back to its own recommended ladder.
|
|
64
64
|
*/
|
|
65
|
-
export declare const PICKER_ROOT_MODEL_IDS: readonly ["claude-opus-5-5", "claude-sonnet-5-5", "gpt-6-
|
|
65
|
+
export declare const PICKER_ROOT_MODEL_IDS: readonly ["claude-opus-5-5", "claude-sonnet-5-5", "gpt-6-2-sol", "gpt-6-luna"];
|
|
66
66
|
/** The catalog entry for any engine's id, or undefined for an unknown model. */
|
|
67
67
|
export declare function findModelCatalogEntry(modelId: string | undefined): ModelCatalogEntry | undefined;
|
|
68
68
|
/** How the active engine pays for a request; a property of the engine, not the model. */
|
|
@@ -66,29 +66,40 @@ export const MODEL_CATALOG = [
|
|
|
66
66
|
recommended: true,
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
id: "gpt-6-
|
|
70
|
-
name: "GPT-6.
|
|
69
|
+
id: "gpt-6-2-sol",
|
|
70
|
+
name: "GPT-6.2 Sol",
|
|
71
71
|
descriptor: "flagship",
|
|
72
72
|
description: "Most capable GPT model for complex reasoning",
|
|
73
73
|
provider: "openai",
|
|
74
74
|
ratings: FLAGSHIP,
|
|
75
75
|
recommended: true,
|
|
76
76
|
},
|
|
77
|
+
{ id: "gpt-6-2-astra", name: "GPT-6.2 Astra", provider: "openai" },
|
|
78
|
+
{
|
|
79
|
+
id: "gpt-6-1-sol",
|
|
80
|
+
name: "GPT-6.1 Sol",
|
|
81
|
+
descriptor: "previousGeneration",
|
|
82
|
+
provider: "openai",
|
|
83
|
+
},
|
|
77
84
|
{ id: "gpt-6-sol", name: "GPT-6 Sol", provider: "openai" },
|
|
78
85
|
{ id: "gpt-6-1-terra", name: "GPT-6.1 Terra", provider: "openai" },
|
|
79
86
|
{
|
|
80
|
-
id: "gemini-
|
|
81
|
-
name: "Gemini
|
|
87
|
+
id: "gemini-4-carbon",
|
|
88
|
+
name: "Gemini 4 Carbon",
|
|
82
89
|
descriptor: "flagship",
|
|
83
90
|
description: "Most capable Gemini model for complex work",
|
|
84
91
|
provider: "google",
|
|
85
92
|
ratings: FLAGSHIP,
|
|
86
93
|
recommended: true,
|
|
87
94
|
},
|
|
88
|
-
{ id: "gemini-4-carbon", name: "Gemini 4 Carbon", provider: "google" },
|
|
89
95
|
{ id: "gemini-4-neon", name: "Gemini 4 Neon", provider: "google" },
|
|
90
96
|
{ id: "gemini-4-argon", name: "Gemini 4 Argon", provider: "google" },
|
|
91
|
-
{
|
|
97
|
+
{
|
|
98
|
+
id: "gemini-3-1-pro",
|
|
99
|
+
name: "Gemini 3.1 Pro",
|
|
100
|
+
descriptor: "previousGeneration",
|
|
101
|
+
provider: "google",
|
|
102
|
+
},
|
|
92
103
|
{
|
|
93
104
|
id: "claude-sonnet-5-5",
|
|
94
105
|
providerDefaultEffort: "high",
|
|
@@ -130,14 +141,20 @@ export const MODEL_CATALOG = [
|
|
|
130
141
|
recommended: true,
|
|
131
142
|
},
|
|
132
143
|
{
|
|
133
|
-
id: "gemini-
|
|
134
|
-
name: "Gemini
|
|
144
|
+
id: "gemini-4-hydrogen",
|
|
145
|
+
name: "Gemini 4 Hydrogen",
|
|
135
146
|
descriptor: "fastLightweight",
|
|
136
147
|
description: "Fast Gemini model for everyday tasks",
|
|
137
148
|
provider: "google",
|
|
138
149
|
ratings: ENTRY,
|
|
139
150
|
recommended: true,
|
|
140
151
|
},
|
|
152
|
+
{
|
|
153
|
+
id: "gemini-3-8-flash",
|
|
154
|
+
name: "Gemini 3.8 Flash",
|
|
155
|
+
descriptor: "previousGeneration",
|
|
156
|
+
provider: "google",
|
|
157
|
+
},
|
|
141
158
|
{
|
|
142
159
|
id: "claude-opus-4-8",
|
|
143
160
|
providerDefaultEffort: "high",
|
|
@@ -153,6 +170,13 @@ export const MODEL_CATALOG = [
|
|
|
153
170
|
descriptor: "previousGeneration",
|
|
154
171
|
provider: "anthropic",
|
|
155
172
|
},
|
|
173
|
+
{
|
|
174
|
+
id: "claude-fable-5-2",
|
|
175
|
+
providerDefaultEffort: "high",
|
|
176
|
+
name: "Claude Fable 5.2",
|
|
177
|
+
shortName: "Fable 5.2",
|
|
178
|
+
provider: "anthropic",
|
|
179
|
+
},
|
|
156
180
|
{
|
|
157
181
|
id: "claude-fable-5-1",
|
|
158
182
|
providerDefaultEffort: "high",
|
|
@@ -291,7 +315,7 @@ const CATALOG_BY_KEY = new Map(MODEL_CATALOG.flatMap((entry) => [
|
|
|
291
315
|
export const PICKER_ROOT_MODEL_IDS = [
|
|
292
316
|
"claude-opus-5-5",
|
|
293
317
|
"claude-sonnet-5-5",
|
|
294
|
-
"gpt-6-
|
|
318
|
+
"gpt-6-2-sol",
|
|
295
319
|
"gpt-6-luna",
|
|
296
320
|
];
|
|
297
321
|
const PICKER_ROOT_RANK = new Map(PICKER_ROOT_MODEL_IDS.map((id, index) => [id, index]));
|
|
@@ -39,24 +39,24 @@ export declare const BUILDER_MODEL_ALIASES: Readonly<Record<string, string>>;
|
|
|
39
39
|
export declare const AGENT_MODEL_CONFIG: {
|
|
40
40
|
readonly builder: {
|
|
41
41
|
readonly defaultModel: "gpt-6-luna";
|
|
42
|
-
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-
|
|
42
|
+
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-6-2-sol", "gpt-6-1-terra", "gpt-6-luna", "gemini-4-hydrogen", "gemini-4-neon", "gemini-4-argon", "gemini-4-carbon", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
43
43
|
};
|
|
44
44
|
readonly anthropic: {
|
|
45
45
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
46
|
-
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-1", "claude-fable-5"];
|
|
46
|
+
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-2", "claude-fable-5-1", "claude-fable-5"];
|
|
47
47
|
};
|
|
48
48
|
readonly aiSdk: {
|
|
49
49
|
readonly anthropic: {
|
|
50
50
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
51
|
-
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-1", "claude-fable-5"];
|
|
51
|
+
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-2", "claude-fable-5-1", "claude-fable-5"];
|
|
52
52
|
};
|
|
53
53
|
readonly openai: {
|
|
54
54
|
readonly defaultModel: "gpt-6-luna";
|
|
55
|
-
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
55
|
+
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.2-sol", "gpt-6.2-astra", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
56
56
|
};
|
|
57
57
|
readonly openrouter: {
|
|
58
58
|
readonly defaultModel: string;
|
|
59
|
-
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
59
|
+
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.2-sol", "openai/gpt-6.2-astra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "anthropic/claude-fable-5.2", "google/gemini-4-carbon", "google/gemini-4-neon", "google/gemini-4-argon", "google/gemini-4-hydrogen", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
60
60
|
};
|
|
61
61
|
readonly google: {
|
|
62
62
|
readonly defaultModel: "gemini-3.8-flash";
|
|
@@ -82,24 +82,24 @@ export declare const AGENT_MODEL_CONFIG: {
|
|
|
82
82
|
};
|
|
83
83
|
export declare const BUILDER_MODEL_CONFIG: {
|
|
84
84
|
readonly defaultModel: "gpt-6-luna";
|
|
85
|
-
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-
|
|
85
|
+
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-6-2-sol", "gpt-6-1-terra", "gpt-6-luna", "gemini-4-hydrogen", "gemini-4-neon", "gemini-4-argon", "gemini-4-carbon", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
86
86
|
};
|
|
87
87
|
export declare const ANTHROPIC_MODEL_CONFIG: {
|
|
88
88
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
89
|
-
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-1", "claude-fable-5"];
|
|
89
|
+
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-2", "claude-fable-5-1", "claude-fable-5"];
|
|
90
90
|
};
|
|
91
91
|
export declare const AI_SDK_MODEL_CONFIG: {
|
|
92
92
|
readonly anthropic: {
|
|
93
93
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
94
|
-
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-1", "claude-fable-5"];
|
|
94
|
+
readonly supportedModels: readonly ["claude-haiku-5-5", "claude-haiku-4-5-20251001", "claude-sonnet-5-5", "claude-opus-5-5", "claude-opus-4-8", "claude-fable-5-2", "claude-fable-5-1", "claude-fable-5"];
|
|
95
95
|
};
|
|
96
96
|
readonly openai: {
|
|
97
97
|
readonly defaultModel: "gpt-6-luna";
|
|
98
|
-
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
98
|
+
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.2-sol", "gpt-6.2-astra", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
99
99
|
};
|
|
100
100
|
readonly openrouter: {
|
|
101
101
|
readonly defaultModel: string;
|
|
102
|
-
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
102
|
+
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.2-sol", "openai/gpt-6.2-astra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "anthropic/claude-fable-5.2", "google/gemini-4-carbon", "google/gemini-4-neon", "google/gemini-4-argon", "google/gemini-4-hydrogen", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
103
103
|
};
|
|
104
104
|
readonly google: {
|
|
105
105
|
readonly defaultModel: "gemini-3.8-flash";
|
|
@@ -238,13 +238,20 @@ export const BUILDER_MODEL_ALIASES = {
|
|
|
238
238
|
"claude-opus-4-7": "claude-opus-5-5",
|
|
239
239
|
"claude-opus-4-8": "claude-opus-5-5",
|
|
240
240
|
"claude-opus-5": "claude-opus-5-5",
|
|
241
|
-
"gpt-5-6-sol": "gpt-6-
|
|
241
|
+
"gpt-5-6-sol": "gpt-6-2-sol",
|
|
242
242
|
"gpt-5-6-luna": "gpt-6-luna",
|
|
243
|
-
"gpt-6-sol": "gpt-6-
|
|
244
|
-
"gpt-6
|
|
245
|
-
"
|
|
246
|
-
"
|
|
247
|
-
"
|
|
243
|
+
"gpt-6-sol": "gpt-6-2-sol",
|
|
244
|
+
"gpt-6-1-sol": "gpt-6-2-sol",
|
|
245
|
+
"gpt-6.1-sol": "gpt-6-2-sol",
|
|
246
|
+
"gpt-6.2-sol": "gpt-6-2-sol",
|
|
247
|
+
"gpt-5-6-terra": "gpt-6-1-terra",
|
|
248
|
+
"gpt-6.1-terra": "gpt-6-1-terra",
|
|
249
|
+
"gpt-5-1-codex-mini": "gpt-5-4-mini",
|
|
250
|
+
"gemini-3-1-pro": "gemini-4-argon",
|
|
251
|
+
"gemini-3-5-flash": "gemini-4-hydrogen",
|
|
252
|
+
"gemini-3-6-flash": "gemini-4-hydrogen",
|
|
253
|
+
"gemini-3-7-flash": "gemini-4-hydrogen",
|
|
254
|
+
"gemini-3-8-flash": "gemini-4-hydrogen",
|
|
248
255
|
};
|
|
249
256
|
const ANTHROPIC_DEFAULT_MODEL_ID = CLAUDE_SONNET_MODEL_ID;
|
|
250
257
|
function openRouterModelId(provider, model) {
|
|
@@ -264,14 +271,13 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
264
271
|
"gpt-5-4",
|
|
265
272
|
"gpt-5-5",
|
|
266
273
|
"gpt-5-4-mini",
|
|
267
|
-
"gpt-
|
|
268
|
-
"gpt-6-1-sol",
|
|
269
|
-
"gpt-6-sol",
|
|
274
|
+
"gpt-6-2-sol",
|
|
270
275
|
"gpt-6-1-terra",
|
|
271
|
-
"gpt-5-6-terra",
|
|
272
276
|
"gpt-6-luna",
|
|
273
|
-
"gemini-
|
|
274
|
-
"gemini-
|
|
277
|
+
"gemini-4-hydrogen",
|
|
278
|
+
"gemini-4-neon",
|
|
279
|
+
"gemini-4-argon",
|
|
280
|
+
"gemini-4-carbon",
|
|
275
281
|
"gemini-3-5-flash-lite",
|
|
276
282
|
"gemini-3-1-flash-lite",
|
|
277
283
|
"grok-code-fast",
|
|
@@ -293,6 +299,7 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
293
299
|
CLAUDE_SONNET_MODEL_ID,
|
|
294
300
|
"claude-opus-5-5",
|
|
295
301
|
"claude-opus-4-8",
|
|
302
|
+
"claude-fable-5-2",
|
|
296
303
|
"claude-fable-5-1",
|
|
297
304
|
"claude-fable-5",
|
|
298
305
|
],
|
|
@@ -306,6 +313,7 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
306
313
|
CLAUDE_SONNET_MODEL_ID,
|
|
307
314
|
"claude-opus-5-5",
|
|
308
315
|
"claude-opus-4-8",
|
|
316
|
+
"claude-fable-5-2",
|
|
309
317
|
"claude-fable-5-1",
|
|
310
318
|
"claude-fable-5",
|
|
311
319
|
],
|
|
@@ -314,6 +322,8 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
314
322
|
defaultModel: FRAMEWORK_DEFAULT_OPENAI_MODEL,
|
|
315
323
|
supportedModels: [
|
|
316
324
|
"gpt-6-luna",
|
|
325
|
+
"gpt-6.2-sol",
|
|
326
|
+
"gpt-6.2-astra",
|
|
317
327
|
"gpt-6.1-sol",
|
|
318
328
|
"gpt-6-sol",
|
|
319
329
|
"gpt-6.1-terra",
|
|
@@ -329,6 +339,8 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
329
339
|
supportedModels: [
|
|
330
340
|
"openai/gpt-6-luna",
|
|
331
341
|
"openai/gpt-5.6-terra",
|
|
342
|
+
"openai/gpt-6.2-sol",
|
|
343
|
+
"openai/gpt-6.2-astra",
|
|
332
344
|
"openai/gpt-6.1-sol",
|
|
333
345
|
"openai/gpt-6-sol",
|
|
334
346
|
"openai/gpt-6.1-terra",
|
|
@@ -344,6 +356,11 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
344
356
|
"anthropic/claude-opus-4.8",
|
|
345
357
|
"anthropic/claude-fable-5",
|
|
346
358
|
"anthropic/claude-fable-5.1",
|
|
359
|
+
"anthropic/claude-fable-5.2",
|
|
360
|
+
"google/gemini-4-carbon",
|
|
361
|
+
"google/gemini-4-neon",
|
|
362
|
+
"google/gemini-4-argon",
|
|
363
|
+
"google/gemini-4-hydrogen",
|
|
347
364
|
"google/gemini-3.8-flash",
|
|
348
365
|
"google/gemini-3.5-flash-lite",
|
|
349
366
|
"google/gemini-3.1-flash-lite",
|
|
@@ -72,6 +72,7 @@ import { agentErrorDetails } from "./action-error-details.js";
|
|
|
72
72
|
import { drainAgentWarnings, formatAgentWarningsForToolResult, } from "./action-warnings.js";
|
|
73
73
|
import { approvalKeyForPrivateHistory, approvalKeyWithArguments, } from "./approval-key.js";
|
|
74
74
|
import { CONTINUE_UNAVAILABLE_CODE, } from "./auto-continue.js";
|
|
75
|
+
import { ensureBuilderModelKnown } from "./builder-gateway-models.js";
|
|
75
76
|
import { clipHead } from "./clip-text.js";
|
|
76
77
|
import { connectionRequiredMessage, priorConnectionContextNote, resolvePriorConnectionNote, } from "./connection-required-note.js";
|
|
77
78
|
import { buildSystemManifestSections, readContextXraySystemSections, } from "./context-xray/manifest.js";
|
|
@@ -5171,6 +5172,9 @@ async function runAgentLoopInternal(opts) {
|
|
|
5171
5172
|
};
|
|
5172
5173
|
if (followUpRunId)
|
|
5173
5174
|
send({ type: "suggestions", suggestions: [] });
|
|
5175
|
+
if (engine.name === "builder") {
|
|
5176
|
+
await ensureBuilderModelKnown(opts.model);
|
|
5177
|
+
}
|
|
5174
5178
|
let model = normalizeModelForEngine(engine, opts.model);
|
|
5175
5179
|
let settlementCandidate = false;
|
|
5176
5180
|
let settledEmptyFinal = false;
|
|
@@ -12068,6 +12072,9 @@ export function createProductionAgentHandler(options) {
|
|
|
12068
12072
|
defaultModel: engine.defaultModel,
|
|
12069
12073
|
}));
|
|
12070
12074
|
workerStep("model_done");
|
|
12075
|
+
if (engine.name === "builder") {
|
|
12076
|
+
await ensureBuilderModelKnown(modelSelection.model);
|
|
12077
|
+
}
|
|
12071
12078
|
const model = normalizeModelForEngine(engine, modelSelection.model);
|
|
12072
12079
|
let effectiveModel = model;
|
|
12073
12080
|
let modelSelectionSource = modelSelection.source;
|
|
@@ -65,6 +65,11 @@ export declare function providerModelSelectionSettingsKey(provider: ProviderMode
|
|
|
65
65
|
export declare function providerForEngineName(engineName: string): ProviderModelSelectionProvider | null;
|
|
66
66
|
/** What an unset selection shows. */
|
|
67
67
|
export declare function recommendedProviderModels(provider: ProviderModelSelectionProvider): readonly string[];
|
|
68
|
+
/**
|
|
69
|
+
* Live-aware version of `recommendedProviderModels`: for Builder.io, refreshes
|
|
70
|
+
* the cached gateway `/discover` catalog (falling back to the bundled list).
|
|
71
|
+
*/
|
|
72
|
+
export declare function recommendedProviderModelsAsync(provider: ProviderModelSelectionProvider): Promise<readonly string[]>;
|
|
68
73
|
/**
|
|
69
74
|
* Trim, drop empties, and de-duplicate, keeping the caller's order. Builder
|
|
70
75
|
* only routes its own catalog, so ids outside it are refused rather than
|
|
@@ -72,6 +77,7 @@ export declare function recommendedProviderModels(provider: ProviderModelSelecti
|
|
|
72
77
|
*/
|
|
73
78
|
export declare function normalizeSelectedModels(provider: ProviderModelSelectionProvider, models: readonly unknown[], options?: {
|
|
74
79
|
preserveCustomModels?: boolean;
|
|
80
|
+
supportedModels?: readonly string[];
|
|
75
81
|
}): string[];
|
|
76
82
|
/** Read one scope's row. Throws when the store can't be read. */
|
|
77
83
|
export declare function readProviderModelSelection(ctx: ProviderModelSelectionContext, provider: ProviderModelSelectionProvider, scope: ProviderModelSelectionScope): Promise<ProviderModelSelectionRow>;
|
|
@@ -17,9 +17,9 @@ import { readAppSecret } from "../secrets/storage.js";
|
|
|
17
17
|
import { canUseDeployCredentialFallbackForRequest, resolveBuilderCredentialsDetailed, resolveSecretDetailed, readDeployCredentialEnv, } from "../server/credential-provider.js";
|
|
18
18
|
import { getRequestOrgId, getRequestUserEmail, } from "../server/request-context.js";
|
|
19
19
|
import { deleteOrgSetting, deleteUserSetting, getOrgSetting, getUserSetting, putOrgSetting, putUserSetting, } from "../settings/index.js";
|
|
20
|
+
import { getCachedBuilderSupportedModels, resolveBuilderSupportedModels, } from "./builder-gateway-models.js";
|
|
20
21
|
import { isCustomOpenAiBaseUrl, OLLAMA_BASE_URL_ENV_VAR, OPENAI_BASE_URL_ENV_VAR, } from "./engine/openai-compatible-endpoint.js";
|
|
21
22
|
import { PROVIDER_ENV_META } from "./engine/provider-env-vars.js";
|
|
22
|
-
import { BUILDER_MODEL_CONFIG } from "./model-config.js";
|
|
23
23
|
import { upgradeModelForProvider } from "./model-version.js";
|
|
24
24
|
export const PROVIDER_MODEL_SELECTION_KEY_PREFIX = "agent-provider-models";
|
|
25
25
|
/** Audit target type for selection changes and refused attempts. */
|
|
@@ -61,10 +61,19 @@ export function providerForEngineName(engineName) {
|
|
|
61
61
|
/** What an unset selection shows. */
|
|
62
62
|
export function recommendedProviderModels(provider) {
|
|
63
63
|
if (provider === "builder")
|
|
64
|
-
return
|
|
64
|
+
return getCachedBuilderSupportedModels();
|
|
65
65
|
return (AGENT_PROVIDER_CATALOG.find((option) => option.id === provider)
|
|
66
66
|
?.supportedModels ?? []);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Live-aware version of `recommendedProviderModels`: for Builder.io, refreshes
|
|
70
|
+
* the cached gateway `/discover` catalog (falling back to the bundled list).
|
|
71
|
+
*/
|
|
72
|
+
export async function recommendedProviderModelsAsync(provider) {
|
|
73
|
+
if (provider === "builder")
|
|
74
|
+
return resolveBuilderSupportedModels();
|
|
75
|
+
return recommendedProviderModels(provider);
|
|
76
|
+
}
|
|
68
77
|
function providerCredentialEnvVar(provider) {
|
|
69
78
|
if (provider === "ollama")
|
|
70
79
|
return OLLAMA_BASE_URL_ENV_VAR;
|
|
@@ -92,14 +101,14 @@ export function normalizeSelectedModels(provider, models, options = {}) {
|
|
|
92
101
|
}
|
|
93
102
|
seen.add(id);
|
|
94
103
|
}
|
|
95
|
-
const supportedModels = recommendedProviderModels(provider);
|
|
104
|
+
const supportedModels = options.supportedModels ?? recommendedProviderModels(provider);
|
|
96
105
|
const normalized = [
|
|
97
106
|
...new Set([...seen].map((id) => options.preserveCustomModels
|
|
98
107
|
? id
|
|
99
108
|
: (upgradeModelForProvider(id, supportedModels, provider) ?? id))),
|
|
100
109
|
];
|
|
101
110
|
if (provider === "builder") {
|
|
102
|
-
const catalog = new Set(
|
|
111
|
+
const catalog = new Set(supportedModels);
|
|
103
112
|
const unknown = normalized.filter((id) => !catalog.has(id));
|
|
104
113
|
if (unknown.length > 0) {
|
|
105
114
|
throw new ProviderModelSelectionError(`Builder.io doesn't offer ${unknown.join(", ")}.`, 400);
|
|
@@ -188,7 +197,7 @@ async function preserveCustomModelsForScope(provider, scope, ctx) {
|
|
|
188
197
|
throw error;
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
|
-
function parseRow(provider, scope, stored, preserveCustomModels = false) {
|
|
200
|
+
function parseRow(provider, scope, stored, preserveCustomModels = false, supportedModels = recommendedProviderModels(provider)) {
|
|
192
201
|
const customModelMetadata = provider === "openai" && preserveCustomModels
|
|
193
202
|
? { preserveCustomModels: true }
|
|
194
203
|
: {};
|
|
@@ -196,7 +205,6 @@ function parseRow(provider, scope, stored, preserveCustomModels = false) {
|
|
|
196
205
|
return { provider, scope, models: null, ...customModelMetadata };
|
|
197
206
|
}
|
|
198
207
|
const models = stored.models.filter((model) => typeof model === "string" && !!model.trim());
|
|
199
|
-
const supportedModels = recommendedProviderModels(provider);
|
|
200
208
|
const currentModels = [
|
|
201
209
|
...new Set(models.map((model) => preserveCustomModels
|
|
202
210
|
? model
|
|
@@ -208,7 +216,7 @@ function parseRow(provider, scope, stored, preserveCustomModels = false) {
|
|
|
208
216
|
scope,
|
|
209
217
|
...customModelMetadata,
|
|
210
218
|
models: provider === "builder"
|
|
211
|
-
? currentModels.filter((model) =>
|
|
219
|
+
? currentModels.filter((model) => supportedModels.includes(model))
|
|
212
220
|
: currentModels,
|
|
213
221
|
...(typeof stored.updatedAt === "number" &&
|
|
214
222
|
Number.isFinite(stored.updatedAt)
|
|
@@ -235,11 +243,14 @@ function scopeIdFor(ctx, scope) {
|
|
|
235
243
|
export async function readProviderModelSelection(ctx, provider, scope) {
|
|
236
244
|
const scopeId = scopeIdFor(ctx, scope);
|
|
237
245
|
const key = providerModelSelectionSettingsKey(provider);
|
|
238
|
-
const stored =
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
246
|
+
const [stored, preserveCustomModels, supportedModels] = await Promise.all([
|
|
247
|
+
scope === "org"
|
|
248
|
+
? getOrgSetting(scopeId, key)
|
|
249
|
+
: getUserSetting(scopeId, key),
|
|
250
|
+
preserveCustomModelsForScope(provider, scope, ctx),
|
|
251
|
+
recommendedProviderModelsAsync(provider),
|
|
252
|
+
]);
|
|
253
|
+
return parseRow(provider, scope, stored, preserveCustomModels, supportedModels);
|
|
243
254
|
}
|
|
244
255
|
/**
|
|
245
256
|
* Whether the caller may change `scope`'s selection. Personal selections are
|
|
@@ -258,9 +269,13 @@ export async function assertMayWriteProviderModelSelection(ctx, scope) {
|
|
|
258
269
|
}
|
|
259
270
|
export async function writeProviderModelSelection(ctx, provider, scope, models) {
|
|
260
271
|
await assertMayWriteProviderModelSelection(ctx, scope);
|
|
261
|
-
const preserveCustomModels = await
|
|
272
|
+
const [preserveCustomModels, supportedModels] = await Promise.all([
|
|
273
|
+
preserveCustomModelsForScope(provider, scope, ctx),
|
|
274
|
+
recommendedProviderModelsAsync(provider),
|
|
275
|
+
]);
|
|
262
276
|
const normalized = normalizeSelectedModels(provider, models, {
|
|
263
277
|
preserveCustomModels,
|
|
278
|
+
supportedModels,
|
|
264
279
|
});
|
|
265
280
|
const scopeId = scopeIdFor(ctx, scope);
|
|
266
281
|
const key = providerModelSelectionSettingsKey(provider);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@agent-native/actions": "0.1.4
|
|
3
|
-
"@agent-native/agentkit": "0.237.2
|
|
2
|
+
"@agent-native/actions": "0.1.4",
|
|
3
|
+
"@agent-native/agentkit": "0.237.2",
|
|
4
4
|
"@agent-native/code-agents-ui": "0.1.75",
|
|
5
|
-
"@agent-native/core": "0.237.2
|
|
6
|
-
"@agent-native/core-corpus": "0.237.2
|
|
7
|
-
"@agent-native/creative-context": "0.8.
|
|
8
|
-
"@agent-native/design-system": "0.237.2
|
|
9
|
-
"@agent-native/dispatch": "0.43.8
|
|
5
|
+
"@agent-native/core": "0.237.2",
|
|
6
|
+
"@agent-native/core-corpus": "0.237.2",
|
|
7
|
+
"@agent-native/creative-context": "0.8.84",
|
|
8
|
+
"@agent-native/design-system": "0.237.2",
|
|
9
|
+
"@agent-native/dispatch": "0.43.8",
|
|
10
10
|
"@agent-native/embedding": "0.2.0",
|
|
11
11
|
"@agent-native/migrate": "0.0.7",
|
|
12
|
-
"@agent-native/otel": "0.1.
|
|
13
|
-
"@agent-native/pinpoint": "0.1.
|
|
14
|
-
"@agent-native/recap-cli": "0.5.
|
|
15
|
-
"@agent-native/scheduling": "0.4.
|
|
12
|
+
"@agent-native/otel": "0.1.51",
|
|
13
|
+
"@agent-native/pinpoint": "0.1.127",
|
|
14
|
+
"@agent-native/recap-cli": "0.5.115",
|
|
15
|
+
"@agent-native/scheduling": "0.4.8",
|
|
16
16
|
"@agent-native/shared-app-config": "0.1.2",
|
|
17
|
-
"@agent-native/skills": "0.4.19
|
|
18
|
-
"@agent-native/toolkit": "0.237.2
|
|
17
|
+
"@agent-native/skills": "0.4.19",
|
|
18
|
+
"@agent-native/toolkit": "0.237.2"
|
|
19
19
|
}
|
|
@@ -320,8 +320,8 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
320
320
|
notes?: string | undefined;
|
|
321
321
|
scope?: "org" | "user" | undefined;
|
|
322
322
|
}, {
|
|
323
|
-
deleted?: undefined;
|
|
324
323
|
id?: undefined;
|
|
324
|
+
deleted?: undefined;
|
|
325
325
|
providers: {
|
|
326
326
|
id: string;
|
|
327
327
|
label: string;
|
|
@@ -338,8 +338,8 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
338
338
|
label?: undefined;
|
|
339
339
|
message?: undefined;
|
|
340
340
|
} | {
|
|
341
|
-
deleted?: undefined;
|
|
342
341
|
id?: undefined;
|
|
342
|
+
deleted?: undefined;
|
|
343
343
|
count?: undefined;
|
|
344
344
|
providers?: undefined;
|
|
345
345
|
found: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getAgentAppModelDefaultForCurrentRequest } from "../../agent/app-model-defaults.js";
|
|
2
|
+
import { readBuilderGatewayModels, } from "../../agent/builder-gateway-models.js";
|
|
2
3
|
import { CHATGPT_SUBSCRIPTION_ENGINE_NAME } from "../../agent/chatgpt-subscription-contract.js";
|
|
3
4
|
import { isDefaultAgentEngineScopeResolved, readDefaultAgentEngineSettingDetailed, resolveDefaultAgentEngineAuthority, } from "../../agent/default-agent-engine.js";
|
|
4
5
|
import { resolveDefaultAgentEngineModel } from "../../agent/engine-status.js";
|
|
@@ -56,6 +57,9 @@ export async function run(args = {}) {
|
|
|
56
57
|
? await getUserLabEnabled(requestEmail, CHATGPT_SUBSCRIPTION_LAB)
|
|
57
58
|
: false;
|
|
58
59
|
const registeredEngines = availableEngines.filter((entry) => entry.name !== CHATGPT_SUBSCRIPTION_ENGINE_NAME || chatGPTLabEnabled);
|
|
60
|
+
const builderCatalogPromise = registeredEngines.some((entry) => entry.name === "builder")
|
|
61
|
+
? readBuilderGatewayModels()
|
|
62
|
+
: Promise.resolve(undefined);
|
|
59
63
|
const chatGPTEntry = registeredEngines.find((entry) => entry.name === CHATGPT_SUBSCRIPTION_ENGINE_NAME);
|
|
60
64
|
let chatGPTCatalog;
|
|
61
65
|
let chatGPTCatalogError;
|
|
@@ -70,19 +74,29 @@ export async function run(args = {}) {
|
|
|
70
74
|
error instanceof Error ? error.message : String(error);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const builderCatalog = await builderCatalogPromise;
|
|
78
|
+
const withDynamicModels = (entry) => {
|
|
79
|
+
if (entry.name === CHATGPT_SUBSCRIPTION_ENGINE_NAME && chatGPTCatalog) {
|
|
80
|
+
return {
|
|
81
|
+
...entry,
|
|
82
|
+
defaultModel: chatGPTCatalog.models[0] ?? "",
|
|
83
|
+
supportedModels: chatGPTCatalog.models,
|
|
84
|
+
modelDisplayNames: chatGPTCatalog.modelDisplayNames,
|
|
85
|
+
};
|
|
79
86
|
}
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
if (entry.name === "builder" && builderCatalog?.state === "available") {
|
|
88
|
+
return {
|
|
89
|
+
...entry,
|
|
90
|
+
supportedModels: builderCatalog.modelIds,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return entry;
|
|
94
|
+
};
|
|
95
|
+
const engines = registeredEngines.map(withDynamicModels);
|
|
82
96
|
const engineFor = (name) => {
|
|
83
97
|
const entry = engines.find((candidate) => candidate.name === name) ??
|
|
84
98
|
getAgentEngineEntry(name);
|
|
85
|
-
return entry ?
|
|
99
|
+
return entry ? withDynamicModels(entry) : undefined;
|
|
86
100
|
};
|
|
87
101
|
const providerKeys = [
|
|
88
102
|
...new Set(engines
|
|
@@ -211,7 +225,9 @@ export async function run(args = {}) {
|
|
|
211
225
|
: applyProviderModelSelection(e.supportedModels, modelSelection),
|
|
212
226
|
...(e.name === CHATGPT_SUBSCRIPTION_ENGINE_NAME && chatGPTCatalog
|
|
213
227
|
? { modelDisplayNames: chatGPTCatalog.modelDisplayNames }
|
|
214
|
-
:
|
|
228
|
+
: e.name === "builder" && builderCatalog?.state === "available"
|
|
229
|
+
? { modelDisplayNames: builderCatalog.displayNames }
|
|
230
|
+
: {}),
|
|
215
231
|
recommendedModels: e.name === CHATGPT_SUBSCRIPTION_ENGINE_NAME
|
|
216
232
|
? (chatGPTCatalog?.models ?? [])
|
|
217
233
|
: e.supportedModels,
|
|
@@ -30,7 +30,7 @@ export const tool = {
|
|
|
30
30
|
},
|
|
31
31
|
model: {
|
|
32
32
|
type: "string",
|
|
33
|
-
description: "Model ID (e.g. 'gpt-6.
|
|
33
|
+
description: "Model ID (e.g. 'gpt-6.2-sol', 'claude-sonnet-5-5', 'gemini-4-argon'). Required for \"set-app-default\"; optional for \"set\" and \"test\" where it defaults to the engine's default model.",
|
|
34
34
|
},
|
|
35
35
|
baseUrl: {
|
|
36
36
|
type: "string",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ActionContractError } from "../../action.js";
|
|
6
6
|
import { normalizeAgentAppModelDefaultAppId, readAgentAppModelDefaultSettings, } from "../../agent/app-model-defaults.js";
|
|
7
|
+
import { ensureBuilderModelKnown } from "../../agent/builder-gateway-models.js";
|
|
7
8
|
import { CHATGPT_SUBSCRIPTION_ENGINE_NAME } from "../../agent/chatgpt-subscription-contract.js";
|
|
8
9
|
import { recordDefaultAgentEngineRefusal, readDefaultAgentEngineSettingDetailed, resolveDefaultAgentEngineAuthority, writeDefaultAgentEngineSelection, } from "../../agent/default-agent-engine.js";
|
|
9
10
|
import { resolveAgentEngineStatus, } from "../../agent/engine-status.js";
|
|
@@ -192,6 +193,9 @@ export async function selectDefaultAgentEngine(input, meta, ctx = {
|
|
|
192
193
|
};
|
|
193
194
|
}
|
|
194
195
|
}
|
|
196
|
+
if (engineName === "builder" && requestedModel) {
|
|
197
|
+
await ensureBuilderModelKnown(requestedModel);
|
|
198
|
+
}
|
|
195
199
|
const acceptsCustomModels = await resolveEngineAcceptsCustomModels(entry);
|
|
196
200
|
const preserveCustomModels = await resolveEnginePreservesCustomModels(entry);
|
|
197
201
|
const resolvedModel = normalizeModelForEngine(entry, requestedModel, {
|
|
@@ -12,6 +12,7 @@ import { ActionDefinitionError, isActionDefinitionError } from "../action.js";
|
|
|
12
12
|
import { clientAbortReason, EXECUTION_LEASE_LOST_ABORT_REASON, } from "../agent/abort-reasons.js";
|
|
13
13
|
import { canUpdateAgentAppModelDefaultSettings, normalizeAgentAppModelDefaultAppId, readAgentAppModelDefaultSettings, resetAgentAppModelDefaultSettings, writeAgentAppModelDefaultSettings, } from "../agent/app-model-defaults.js";
|
|
14
14
|
import { approvalKeyWithArguments } from "../agent/approval-key.js";
|
|
15
|
+
import { ensureBuilderModelKnown } from "../agent/builder-gateway-models.js";
|
|
15
16
|
import { CHATGPT_SUBSCRIPTION_ENGINE_NAME } from "../agent/chatgpt-subscription-contract.js";
|
|
16
17
|
import { readDefaultAgentEngineSetting } from "../agent/default-agent-engine.js";
|
|
17
18
|
import { DEFAULT_ANTHROPIC_MODEL } from "../agent/default-model.js";
|
|
@@ -4614,6 +4615,9 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4614
4615
|
})) ??
|
|
4615
4616
|
engine.defaultModel ??
|
|
4616
4617
|
resolvedModel;
|
|
4618
|
+
if (engine.name === "builder") {
|
|
4619
|
+
await ensureBuilderModelKnown(modelCandidate);
|
|
4620
|
+
}
|
|
4617
4621
|
const model = normalizeModelForEngine(engine, modelCandidate);
|
|
4618
4622
|
// Intentionally NOT setting `initialToolNames` here (unlike
|
|
4619
4623
|
// schedulerDeps/dispatcher above). `AgentTeamRunConfig.actions`
|
|
@@ -4878,6 +4882,9 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4878
4882
|
};
|
|
4879
4883
|
}
|
|
4880
4884
|
}
|
|
4885
|
+
if (entry.name === "builder") {
|
|
4886
|
+
await ensureBuilderModelKnown(model);
|
|
4887
|
+
}
|
|
4881
4888
|
if (entry.name === "builder" &&
|
|
4882
4889
|
normalizeModelForEngine(entry, model) !== model) {
|
|
4883
4890
|
setResponseStatus(event, 400);
|
|
@@ -54,9 +54,9 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
54
54
|
error: string;
|
|
55
55
|
}>;
|
|
56
56
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
-
errorCode?: undefined;
|
|
58
57
|
code?: undefined;
|
|
59
58
|
error: string;
|
|
59
|
+
errorCode?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
code?: undefined;
|
|
62
62
|
error: string;
|
|
@@ -66,9 +66,9 @@ export declare function createAgentEngineApiKeyHandler(): import("h3").EventHand
|
|
|
66
66
|
error: string;
|
|
67
67
|
code: ProviderKeyCheckCode;
|
|
68
68
|
} | {
|
|
69
|
-
errorCode?: undefined;
|
|
70
69
|
error?: undefined;
|
|
71
70
|
code?: undefined;
|
|
71
|
+
errorCode?: undefined;
|
|
72
72
|
ok: boolean;
|
|
73
73
|
key: string;
|
|
74
74
|
baseUrlKey?: string | undefined;
|
|
@@ -32,8 +32,8 @@ export declare function createFirstTouchHandler(): import("h3").EventHandlerWith
|
|
|
32
32
|
reason: "expired";
|
|
33
33
|
firstTouch?: undefined;
|
|
34
34
|
} | {
|
|
35
|
-
reason?: undefined;
|
|
36
35
|
error?: undefined;
|
|
36
|
+
reason?: undefined;
|
|
37
37
|
stored: true;
|
|
38
38
|
firstTouch: FirstTouchAttribution;
|
|
39
39
|
}>>;
|
package/dist/usage/store.js
CHANGED
|
@@ -59,6 +59,10 @@ export function builderCreditsFromCostCents(cents) {
|
|
|
59
59
|
return Math.ceil(credits * 1000) / 1000;
|
|
60
60
|
}
|
|
61
61
|
const PRICING = [
|
|
62
|
+
{
|
|
63
|
+
match: /fable-5[.-]2/i,
|
|
64
|
+
pricing: { input: 800, output: 4000, cacheRead: 20, cacheWrite: 1000 },
|
|
65
|
+
},
|
|
62
66
|
{
|
|
63
67
|
match: /fable-5/i,
|
|
64
68
|
pricing: { input: 1000, output: 5000, cacheRead: 100, cacheWrite: 1250 },
|
|
@@ -75,6 +79,22 @@ const PRICING = [
|
|
|
75
79
|
match: /haiku/i,
|
|
76
80
|
pricing: { input: 100, output: 500, cacheRead: 10, cacheWrite: 125 },
|
|
77
81
|
},
|
|
82
|
+
{
|
|
83
|
+
match: /gpt-6[.-]2-astra/i,
|
|
84
|
+
pricing: { input: 800, output: 4000, cacheRead: 40, cacheWrite: 1000 },
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
match: /gpt-6[.-][12]-sol/i,
|
|
88
|
+
pricing: { input: 200, output: 1000, cacheRead: 10, cacheWrite: 250 },
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
match: /gpt-6[.-]1-terra/i,
|
|
92
|
+
pricing: { input: 100, output: 500, cacheRead: 5, cacheWrite: 125 },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
match: /gpt-6-luna/i,
|
|
96
|
+
pricing: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
|
|
97
|
+
},
|
|
78
98
|
{
|
|
79
99
|
match: /gpt-5[.-]6-sol/i,
|
|
80
100
|
pricing: { input: 400, output: 2000, cacheRead: 40, cacheWrite: 500 },
|
|
@@ -91,6 +111,18 @@ const PRICING = [
|
|
|
91
111
|
match: /gpt-5/i,
|
|
92
112
|
pricing: { input: 125, output: 1000, cacheRead: 12.5, cacheWrite: 0 },
|
|
93
113
|
},
|
|
114
|
+
{
|
|
115
|
+
match: /gemini-4-(?:argon|carbon)/i,
|
|
116
|
+
pricing: { input: 400, output: 2000, cacheRead: 20, cacheWrite: 0 },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
match: /gemini-4-neon/i,
|
|
120
|
+
pricing: { input: 300, output: 1500, cacheRead: 15, cacheWrite: 0 },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
match: /gemini-4-hydrogen/i,
|
|
124
|
+
pricing: { input: 150, output: 750, cacheRead: 7.5, cacheWrite: 0 },
|
|
125
|
+
},
|
|
94
126
|
{
|
|
95
127
|
match: /gemini-3[.-]1-pro/i,
|
|
96
128
|
pricing: { input: 125, output: 1000, cacheRead: 31, cacheWrite: 0 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.237.2
|
|
3
|
+
"version": "0.237.2",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -835,9 +835,9 @@
|
|
|
835
835
|
"yaml": "^2.9.0",
|
|
836
836
|
"yjs": "^13.6.33",
|
|
837
837
|
"zod": "^4.3.6",
|
|
838
|
-
"@agent-native/actions": "^0.1.4
|
|
839
|
-
"@agent-native/agentkit": "^0.237.2
|
|
840
|
-
"@agent-native/recap-cli": "^0.5.
|
|
838
|
+
"@agent-native/actions": "^0.1.4",
|
|
839
|
+
"@agent-native/agentkit": "^0.237.2",
|
|
840
|
+
"@agent-native/recap-cli": "^0.5.115"
|
|
841
841
|
},
|
|
842
842
|
"devDependencies": {
|
|
843
843
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -911,7 +911,7 @@
|
|
|
911
911
|
"xlsx": "^0.18.5"
|
|
912
912
|
},
|
|
913
913
|
"peerDependencies": {
|
|
914
|
-
"@agent-native/core-corpus": "0.
|
|
914
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
915
915
|
"@ai-sdk/anthropic": ">=3",
|
|
916
916
|
"@ai-sdk/cohere": ">=3",
|
|
917
917
|
"@ai-sdk/google": ">=3.0.152",
|