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

推荐订阅源

量子位
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
G
Google Developers Blog
腾讯CDC
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
博客园_首页
T
Tailwind CSS Blog
C
Check Point Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI

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
feat: add model list auth index · openclaw/openclaw@a777b82
shakkernerd · 2026-04-30 · via Recent Commits to openclaw:main

@@ -0,0 +1,83 @@

1+

import type { AuthProfileStore } from "../../agents/auth-profiles/types.js";

2+

import { resolveProviderEnvApiKeyCandidates } from "../../agents/model-auth-env-vars.js";

3+

import { resolveEnvApiKey } from "../../agents/model-auth-env.js";

4+

import { resolveAwsSdkEnvVarName } from "../../agents/model-auth-runtime-shared.js";

5+

import { hasUsableCustomProviderApiKey } from "../../agents/model-auth.js";

6+

import { resolveProviderAuthAliasMap } from "../../agents/provider-auth-aliases.js";

7+

import { normalizeProviderIdForAuth } from "../../agents/provider-id.js";

8+

import type { OpenClawConfig } from "../../config/types.openclaw.js";

9+

import { readPersistedInstalledPluginIndexSync } from "../../plugins/installed-plugin-index-store.js";

10+11+

export type ModelListAuthIndex = {

12+

hasProviderAuth(provider: string): boolean;

13+

};

14+15+

export type CreateModelListAuthIndexParams = {

16+

cfg: OpenClawConfig;

17+

authStore: AuthProfileStore;

18+

env?: NodeJS.ProcessEnv;

19+

syntheticAuthProviderRefs?: readonly string[];

20+

};

21+22+

export const EMPTY_MODEL_LIST_AUTH_INDEX: ModelListAuthIndex = {

23+

hasProviderAuth: () => false,

24+

};

25+26+

function normalizeAuthProvider(

27+

provider: string,

28+

aliasMap: Readonly<Record<string, string>>,

29+

): string {

30+

const normalized = normalizeProviderIdForAuth(provider);

31+

return aliasMap[normalized] ?? normalized;

32+

}

33+34+

function listPersistedSyntheticAuthProviderRefs(): readonly string[] {

35+

const index = readPersistedInstalledPluginIndexSync();

36+

return index?.plugins.flatMap((plugin) => plugin.syntheticAuthRefs ?? []) ?? [];

37+

}

38+39+

export function createModelListAuthIndex(

40+

params: CreateModelListAuthIndexParams,

41+

): ModelListAuthIndex {

42+

const env = params.env ?? process.env;

43+

const aliasMap = resolveProviderAuthAliasMap({ config: params.cfg, env });

44+

const envCandidateMap = resolveProviderEnvApiKeyCandidates({ config: params.cfg, env });

45+

const authenticatedProviders = new Set<string>();

46+

const addProvider = (provider: string | undefined) => {

47+

if (!provider?.trim()) {

48+

return;

49+

}

50+

authenticatedProviders.add(normalizeAuthProvider(provider, aliasMap));

51+

};

52+53+

for (const credential of Object.values(params.authStore.profiles ?? {})) {

54+

addProvider(credential.provider);

55+

}

56+57+

for (const provider of Object.keys(envCandidateMap)) {

58+

if (resolveEnvApiKey(provider, env, { aliasMap, candidateMap: envCandidateMap })) {

59+

addProvider(provider);

60+

}

61+

}

62+63+

if (resolveAwsSdkEnvVarName(env)) {

64+

addProvider("amazon-bedrock");

65+

}

66+67+

for (const provider of Object.keys(params.cfg.models?.providers ?? {})) {

68+

if (hasUsableCustomProviderApiKey(params.cfg, provider, env)) {

69+

addProvider(provider);

70+

}

71+

}

72+73+

for (const provider of params.syntheticAuthProviderRefs ??

74+

listPersistedSyntheticAuthProviderRefs()) {

75+

addProvider(provider);

76+

}

77+78+

return {

79+

hasProviderAuth(provider: string): boolean {

80+

return authenticatedProviders.has(normalizeAuthProvider(provider, aliasMap));

81+

},

82+

};

83+

}