Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 168 additions & 33 deletions dist/cli.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cli.js.map

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,16 +1143,6 @@ type BlockRunModel = {
flatPrice?: number;
};
declare const BLOCKRUN_MODELS: BlockRunModel[];
/**
* All BlockRun models in OpenClaw format (including aliases).
* Used for proxy-side resolution (alias → target ID), tool routing, etc.
*
* Catalog entries shadowed by an identically-keyed alias are excluded:
* resolveModelAlias checks MODEL_ALIASES first, so those catalog entries are
* unreachable and their metadata (name/pricing) would misadvertise what
* callers actually get. The alias-derived entry carries the redirect
* target's real metadata instead.
*/
declare const OPENCLAW_MODELS: ModelDefinitionConfig[];
/**
* Build a ModelProviderConfig for BlockRun.
Expand Down
72 changes: 46 additions & 26 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRequire as __cjs_createRequire } from 'node:module'; const require = __cjs_createRequire(import.meta.url);
import { createRequire as __blockrun_createRequire } from 'node:module'; const require = __blockrun_createRequire(import.meta.url);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
Expand Down Expand Up @@ -176083,31 +176083,31 @@ var top_models_default = [
"anthropic/claude-sonnet-5",
"anthropic/claude-sonnet-4.6",
"anthropic/claude-haiku-4.5",
"openai/gpt-5.6-terra",
"openai/gpt-5.6-sol",
"openai/gpt-5.6-terra",
"openai/gpt-5.6-luna",
"openai/gpt-5.5",
"openai/gpt-5.4-pro",
"openai/gpt-5.4",
"openai/gpt-5.4-mini",
"openai/gpt-5.4-nano",
"openai/gpt-5.3-codex",
"google/gemini-3.1-pro",
"google/gemini-3.5-flash",
"google/gemini-3.1-pro",
"google/gemini-3.1-flash-lite",
"google/gemini-3-flash-preview",
"xai/grok-4.3",
"xai/grok-4-0709",
"xai/grok-4-1-fast-reasoning",
"xai/grok-3",
"xai/grok-4-0709",
"xai/grok-build-0.1",
"xai/grok-3",
"zai/glm-5.2",
"zai/glm-5.1",
"zai/glm-5-turbo",
"zai/glm-5",
"zai/glm-5-turbo",
"moonshot/kimi-k2.7",
"minimax/minimax-m3",
"minimax/minimax-m2.7",
"moonshot/kimi-k2.7",
"deepseek/deepseek-v4-pro",
"deepseek/deepseek-chat",
"deepseek/deepseek-reasoner",
Expand Down Expand Up @@ -176233,6 +176233,9 @@ var MODEL_ALIASES = {
// Google
// gemini-3-pro-preview delisted by Google 2026-06-06 — mirror the gateway
// redirect to its successor so pinned callers land on 3.1-pro, not an error.
"gemini-pro": "google/gemini-3.1-pro",
"gemini-3-pro": "google/gemini-3.1-pro",
"gemini-3.1-pro": "google/gemini-3.1-pro",
"google/gemini-3-pro-preview": "google/gemini-3.1-pro",
"gemini-3-pro-preview": "google/gemini-3.1-pro",
gemini: "google/gemini-2.5-pro",
Expand Down Expand Up @@ -177502,14 +177505,17 @@ function toOpenClawModel(m) {
maxTokens: m.maxOutput
};
}
var ALIAS_MODELS = Object.entries(MODEL_ALIASES).filter(([alias]) => !alias.includes("/")).map(([alias, targetId]) => {
const target = BLOCKRUN_MODELS.find((m) => m.id === targetId);
if (!target) return null;
return toOpenClawModel({ ...target, id: alias, name: `${alias} \u2192 ${target.name}` });
}).filter((m) => m !== null);
var ALL_OPENCLAW_MODELS = BLOCKRUN_MODELS.filter(
(m) => !(m.id.includes("/") && m.id in MODEL_ALIASES)
).map(toOpenClawModel);
var TOP_MODEL_IDS = new Set(TOP_MODELS);
var ALL_OPENCLAW_MODEL_BY_ID = new Map(ALL_OPENCLAW_MODELS.map((m) => [m.id, m]));
var OPENCLAW_MODELS = [
...BLOCKRUN_MODELS.filter((m) => !(m.id in MODEL_ALIASES)).map(toOpenClawModel),
...ALIAS_MODELS
...TOP_MODELS.flatMap((id2) => {
const model = ALL_OPENCLAW_MODEL_BY_ID.get(id2);
return model ? [model] : [];
}),
...ALL_OPENCLAW_MODELS.filter((m) => !TOP_MODEL_IDS.has(m.id))
];
var OPENCLAW_MODEL_BY_ID = new Map(OPENCLAW_MODELS.map((m) => [m.id, m]));
var VISIBLE_OPENCLAW_MODELS = TOP_MODELS.flatMap((id2) => {
Expand Down Expand Up @@ -273763,14 +273769,14 @@ function toOpenClawModel2(m) {
maxTokens: m.maxOutput
};
}
var ALIAS_MODELS2 = Object.entries(MODEL_ALIASES2).filter(([alias]) => !alias.includes("/")).map(([alias, targetId]) => {
var ALIAS_MODELS = Object.entries(MODEL_ALIASES2).filter(([alias]) => !alias.includes("/")).map(([alias, targetId]) => {
const target = BLOCKRUN_MODELS2.find((m) => m.id === targetId);
if (!target) return null;
return toOpenClawModel2({ ...target, id: alias, name: `${alias} \u2192 ${target.name}` });
}).filter((m) => m !== null);
var OPENCLAW_MODELS2 = [
...BLOCKRUN_MODELS2.filter((m) => !(m.id in MODEL_ALIASES2)).map(toOpenClawModel2),
...ALIAS_MODELS2
...ALIAS_MODELS
];
var OPENCLAW_MODEL_BY_ID2 = new Map(OPENCLAW_MODELS2.map((m) => [m.id, m]));
var VISIBLE_OPENCLAW_MODELS2 = TOP_MODELS2.flatMap((id2) => {
Expand Down Expand Up @@ -284238,12 +284244,8 @@ function injectModelsConfig(logger48, options = {}) {
fixed = true;
}
const currentModels = blockrun.models;
const currentModelIds = new Set(
Array.isArray(currentModels) ? currentModels.map((m) => m?.id).filter((id2) => typeof id2 === "string") : []
);
const expectedModelIds = VISIBLE_OPENCLAW_MODELS.map((m) => m.id);
const expectedSet = new Set(expectedModelIds);
const needsModelUpdate = !currentModels || !Array.isArray(currentModels) || currentModels.length !== VISIBLE_OPENCLAW_MODELS.length || expectedModelIds.some((id2) => !currentModelIds.has(id2)) || Array.from(currentModelIds).some((id2) => !expectedSet.has(id2));
const needsModelUpdate = !currentModels || !Array.isArray(currentModels) || currentModels.length !== VISIBLE_OPENCLAW_MODELS.length || currentModels.some((m, index2) => m?.id !== expectedModelIds[index2]);
if (needsModelUpdate) {
blockrun.models = VISIBLE_OPENCLAW_MODELS;
fixed = true;
Expand Down Expand Up @@ -284292,30 +284294,48 @@ function injectModelsConfig(logger48, options = {}) {
needsWrite = true;
logger48.info(`Removed ${removedDeprecatedCount} deprecated model entries from allowlist`);
}
const expectedBlockrunKeys = new Set(TOP_MODELS.map((id2) => `blockrun/${id2}`));
const expectedBlockrunKeys = TOP_MODELS.map((id2) => `blockrun/${id2}`);
const expectedBlockrunKeySet = new Set(expectedBlockrunKeys);
const existingNonBlockrunAllowlist = Object.fromEntries(
Object.entries(allowlist).filter(([key2]) => !key2.startsWith("blockrun/"))
);
let addedCount = 0;
let prunedCount = 0;
for (const key2 of Object.keys(allowlist)) {
if (key2.startsWith("blockrun/") && !expectedBlockrunKeys.has(key2)) {
if (key2.startsWith("blockrun/") && !expectedBlockrunKeySet.has(key2)) {
delete allowlist[key2];
prunedCount++;
}
}
for (const id2 of TOP_MODELS) {
const key2 = `blockrun/${id2}`;
const currentBlockrunKeys = Object.keys(allowlist).filter((key2) => key2.startsWith("blockrun/"));
const needsAllowlistOrderUpdate = expectedBlockrunKeys.some(
(key2, index2) => currentBlockrunKeys[index2] !== key2
);
for (const key2 of expectedBlockrunKeys) {
if (!allowlist[key2]) {
allowlist[key2] = {};
addedCount++;
}
}
if (addedCount > 0 || prunedCount > 0) {
if (addedCount > 0 || prunedCount > 0 || needsAllowlistOrderUpdate) {
for (const key2 of Object.keys(allowlist)) {
delete allowlist[key2];
}
Object.assign(
allowlist,
Object.fromEntries(expectedBlockrunKeys.map((key2) => [key2, {}])),
existingNonBlockrunAllowlist
);
needsWrite = true;
if (prunedCount > 0) {
logger48.info(`Pruned ${prunedCount} stale blockrun/* entries from allowlist`);
}
if (addedCount > 0) {
logger48.info(`Added ${addedCount} models to allowlist (${TOP_MODELS.length} total)`);
}
if (needsAllowlistOrderUpdate) {
logger48.info(`Reordered ${TOP_MODELS.length} blockrun/* allowlist entries`);
}
}
if (!config.tools || typeof config.tools !== "object" || Array.isArray(config.tools)) {
config.tools = {};
Expand Down
Loading
Loading