惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
博客园 - 司徒正美
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - Franky
B
Blog
V
V2EX
J
Java Code Geeks
D
Docker
博客园 - 叶小钗
The Cloudflare Blog
量子位
博客园_首页
MongoDB | Blog
MongoDB | Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(live): scope gateway model discovery · openclaw/open...
vincentkoc · 2026-05-07 · via Recent Commits to openclaw:main

@@ -1,11 +1,13 @@

11

import { randomBytes, randomUUID } from "node:crypto";

2+

import { writeSync } from "node:fs";

23

import fs from "node:fs/promises";

34

import { createServer } from "node:net";

45

import os from "node:os";

56

import path from "node:path";

67

import {

78

clampThinkingLevel,

89

type Api,

10+

getModels,

911

type Model,

1012

type ModelThinkingLevel,

1113

} from "@mariozechner/pi-ai";

@@ -279,7 +281,7 @@ async function withGatewayLiveModelTimeout<T>(operation: Promise<T>, context: st

279281

}

280282281283

function logProgress(message: string): void {

282-

process.stderr.write(`[live] ${message}\n`);

284+

writeSync(2, `[live] ${message}\n`);

283285

}

284286285287

function enterProductionEnvForLiveRun() {

@@ -1408,6 +1410,43 @@ type LiveModelRegistry = {

14081410

getAll(): Array<Model<Api>>;

14091411

};

141014121413+

function loadProviderScopedBuiltInModels(providerList: readonly string[]): Array<Model<Api>> {

1414+

const models: Array<Model<Api>> = [];

1415+

const seen = new Set<string>();

1416+

for (const rawProvider of providerList) {

1417+

const provider = normalizeProviderId(rawProvider);

1418+

if (!provider) {

1419+

continue;

1420+

}

1421+

for (const model of getModels(provider)) {

1422+

const key = `${normalizeProviderId(model.provider)}/${model.id.toLowerCase()}`;

1423+

if (seen.has(key)) {

1424+

continue;

1425+

}

1426+

seen.add(key);

1427+

models.push(model);

1428+

}

1429+

}

1430+

return models;

1431+

}

1432+1433+

function createStaticLiveModelRegistry(models: Array<Model<Api>>): LiveModelRegistry {

1434+

return {

1435+

find(provider, modelId) {

1436+

const normalizedProvider = normalizeProviderId(provider);

1437+

const normalizedModelId = modelId.toLowerCase();

1438+

return models.find(

1439+

(model) =>

1440+

normalizeProviderId(model.provider) === normalizedProvider &&

1441+

model.id.toLowerCase() === normalizedModelId,

1442+

);

1443+

},

1444+

getAll() {

1445+

return models;

1446+

},

1447+

};

1448+

}

1449+14111450

function parseExplicitLiveModelRef(

14121451

raw: string,

14131452

providerFilter: Set<string> | null,

@@ -2410,45 +2449,54 @@ describeLive("gateway live (dev agent, profile keys)", () => {

24102449

);

2411245024122451

const agentDir = resolveDefaultAgentDir(cfg);

2413-

logProgress("[all-models] loading auth profiles");

2414-

const authProfileStore = await withGatewayLiveSetupTimeout(

2415-

Promise.resolve().then(() =>

2416-

providerList

2417-

? ensureAuthProfileStoreWithoutExternalProfiles(agentDir, {

2418-

allowKeychainPrompt: false,

2419-

})

2420-

: ensureAuthProfileStore(agentDir, {

2421-

allowKeychainPrompt: false,

2422-

}),

2423-

),

2424-

"[all-models] load auth profiles",

2425-

);

2426-

const authStorage = await withGatewayLiveSetupTimeout(

2427-

Promise.resolve().then(() =>

2428-

discoverAuthStorage(agentDir, {

2429-

config: cfg,

2430-

env: process.env,

2431-

...(providerList

2432-

? {

2433-

skipExternalAuthProfiles: true,

2434-

syntheticAuthProviderRefs: [],

2435-

}

2436-

: {}),

2437-

}),

2438-

),

2439-

"[all-models] load auth storage",

2440-

);

2441-

logProgress("[all-models] loading model registry");

2442-

const modelRegistry = discoverModels(authStorage, agentDir);

2443-

const all = await withGatewayLiveSetupTimeout(

2444-

Promise.resolve().then(() => modelRegistry.getAll()),

2445-

"[all-models] load model registry",

2446-

);

2447-24482452

const rawModels = process.env.OPENCLAW_LIVE_GATEWAY_MODELS?.trim();

24492453

const useModern = !rawModels || rawModels === "modern" || rawModels === "all";

24502454

const useExplicit = Boolean(rawModels) && !useModern;

24512455

const filter = useExplicit ? parseFilter(rawModels) : null;

2456+

const useProviderScopedBuiltIns = providerList !== null && !useExplicit;

2457+

let authProfileStore: AuthProfileStore | undefined;

2458+

let modelRegistry: LiveModelRegistry;

2459+

let all: Array<Model<Api>>;

2460+

if (useProviderScopedBuiltIns) {

2461+

logProgress("[all-models] loading provider-scoped model refs");

2462+

all = loadProviderScopedBuiltInModels(providerList);

2463+

modelRegistry = createStaticLiveModelRegistry(all);

2464+

} else {

2465+

logProgress("[all-models] loading auth profiles");

2466+

authProfileStore = await withGatewayLiveSetupTimeout(

2467+

Promise.resolve().then(() =>

2468+

providerList

2469+

? ensureAuthProfileStoreWithoutExternalProfiles(agentDir, {

2470+

allowKeychainPrompt: false,

2471+

})

2472+

: ensureAuthProfileStore(agentDir, {

2473+

allowKeychainPrompt: false,

2474+

}),

2475+

),

2476+

"[all-models] load auth profiles",

2477+

);

2478+

const authStorage = await withGatewayLiveSetupTimeout(

2479+

Promise.resolve().then(() =>

2480+

discoverAuthStorage(agentDir, {

2481+

config: cfg,

2482+

env: process.env,

2483+

...(providerList

2484+

? {

2485+

skipExternalAuthProfiles: true,

2486+

syntheticAuthProviderRefs: [],

2487+

}

2488+

: {}),

2489+

}),

2490+

),

2491+

"[all-models] load auth storage",

2492+

);

2493+

logProgress("[all-models] loading model registry");

2494+

modelRegistry = discoverModels(authStorage, agentDir);

2495+

all = await withGatewayLiveSetupTimeout(

2496+

Promise.resolve().then(() => modelRegistry.getAll()),

2497+

"[all-models] load model registry",

2498+

);

2499+

}

24522500

const maxModels = GATEWAY_LIVE_MAX_MODELS;

24532501

const targetMatcher = createLiveTargetMatcher({

24542502

providerFilter: PROVIDERS,