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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Y
Y Combinator Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
S
SegmentFault 最新的问题
J
Java Code Geeks
V
Visual Studio Blog
H
Help Net Security
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
B
Blog RSS Feed
The Cloudflare Blog
MyScale Blog
MyScale Blog
月光博客
月光博客
Microsoft Security Blog
Microsoft Security 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
refactor(providers): reuse capability provider registry m...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main
11

// Registers music generation provider runtimes by normalized provider id.

2-

import { normalizeProviderId } from "../agents/model-selection.js";

32

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

4-

import { isBlockedObjectKey } from "../infra/prototype-keys.js";

53

import { resolvePluginCapabilityProviders } from "../plugins/capability-provider-runtime.js";

4+

import {

5+

buildCapabilityProviderMaps,

6+

normalizeCapabilityProviderId,

7+

} from "../plugins/provider-registry-shared.js";

68

import type { MusicGenerationProviderPlugin } from "../plugins/types.js";

79810

/**

@@ -12,20 +14,6 @@ import type { MusicGenerationProviderPlugin } from "../plugins/types.js";

1214

* rejecting unsafe object keys before they reach Maps or config-derived lookups.

1315

*/

1416

const BUILTIN_MUSIC_GENERATION_PROVIDERS: readonly MusicGenerationProviderPlugin[] = [];

15-

const UNSAFE_PROVIDER_IDS = new Set(["__proto__", "constructor", "prototype"]);

16-17-

function normalizeMusicGenerationProviderId(id: string | undefined): string | undefined {

18-

const normalized = normalizeProviderId(id ?? "");

19-

if (!normalized || isBlockedObjectKey(normalized)) {

20-

return undefined;

21-

}

22-

return normalized;

23-

}

24-25-

function isSafeMusicGenerationProviderId(id: string | undefined): id is string {

26-

// Keep prototype-pollution sentinel names out even after normal provider-id normalization.

27-

return Boolean(id && !UNSAFE_PROVIDER_IDS.has(id));

28-

}

29173018

function resolvePluginMusicGenerationProviders(

3119

cfg?: OpenClawConfig,

@@ -40,31 +28,10 @@ function buildProviderMaps(cfg?: OpenClawConfig): {

4028

canonical: Map<string, MusicGenerationProviderPlugin>;

4129

aliases: Map<string, MusicGenerationProviderPlugin>;

4230

} {

43-

const canonical = new Map<string, MusicGenerationProviderPlugin>();

44-

const aliases = new Map<string, MusicGenerationProviderPlugin>();

45-

const register = (provider: MusicGenerationProviderPlugin) => {

46-

const id = normalizeMusicGenerationProviderId(provider.id);

47-

if (!isSafeMusicGenerationProviderId(id)) {

48-

return;

49-

}

50-

canonical.set(id, provider);

51-

aliases.set(id, provider);

52-

for (const alias of provider.aliases ?? []) {

53-

const normalizedAlias = normalizeMusicGenerationProviderId(alias);

54-

if (isSafeMusicGenerationProviderId(normalizedAlias)) {

55-

aliases.set(normalizedAlias, provider);

56-

}

57-

}

58-

};

59-60-

for (const provider of BUILTIN_MUSIC_GENERATION_PROVIDERS) {

61-

register(provider);

62-

}

63-

for (const provider of resolvePluginMusicGenerationProviders(cfg)) {

64-

register(provider);

65-

}

66-67-

return { canonical, aliases };

31+

return buildCapabilityProviderMaps(

32+

[...BUILTIN_MUSIC_GENERATION_PROVIDERS, ...resolvePluginMusicGenerationProviders(cfg)],

33+

normalizeCapabilityProviderId,

34+

);

6835

}

69367037

/** List canonical music generation providers available for the current config. */

@@ -79,7 +46,7 @@ export function getMusicGenerationProvider(

7946

providerId: string | undefined,

8047

cfg?: OpenClawConfig,

8148

): MusicGenerationProviderPlugin | undefined {

82-

const normalized = normalizeMusicGenerationProviderId(providerId);

49+

const normalized = normalizeCapabilityProviderId(providerId);

8350

if (!normalized) {

8451

return undefined;

8552

}