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

推荐订阅源

B
Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
雷峰网
雷峰网
博客园_首页
WordPress大学
WordPress大学
博客园 - 司徒正美
爱范儿
爱范儿
博客园 - 聂微东
IT之家
IT之家
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
博客园 - Franky
V
V2EX
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
fix: cache capability provider manifest ids · openclaw/op...
shakkernerd · 2026-04-27 · via Recent Commits to openclaw:main

@@ -4,6 +4,11 @@ import {

44

withBundledPluginEnablementCompat,

55

withBundledPluginVitestCompat,

66

} from "./bundled-compat.js";

7+

import {

8+

buildPluginSnapshotCacheEnvKey,

9+

resolvePluginSnapshotCacheTtlMs,

10+

shouldUsePluginSnapshotCache,

11+

} from "./cache-controls.js";

712

import { hasExplicitPluginConfig } from "./config-policy.js";

813

import { resolveRuntimePluginRegistry } from "./loader.js";

914

import { loadPluginManifestRegistryForPluginRegistry } from "./plugin-registry.js";

@@ -32,6 +37,11 @@ type CapabilityContractKey =

3237

type CapabilityProviderForKey<K extends CapabilityProviderRegistryKey> =

3338

PluginRegistry[K][number] extends { provider: infer T } ? T : never;

343940+

type CapabilityProviderPluginIdCacheEntry = {

41+

expiresAt: number;

42+

pluginIds: string[];

43+

};

44+3545

const CAPABILITY_CONTRACT_KEY: Record<CapabilityProviderRegistryKey, CapabilityContractKey> = {

3646

memoryEmbeddingProviders: "memoryEmbeddingProviders",

3747

speechProviders: "speechProviders",

@@ -43,15 +53,86 @@ const CAPABILITY_CONTRACT_KEY: Record<CapabilityProviderRegistryKey, CapabilityC

4353

musicGenerationProviders: "musicGenerationProviders",

4454

};

455556+

const capabilityProviderPluginIdCache = new WeakMap<

57+

OpenClawConfig,

58+

WeakMap<NodeJS.ProcessEnv, Map<string, CapabilityProviderPluginIdCacheEntry>>

59+

>();

60+61+

function buildCapabilityProviderPluginIdCacheKey(params: {

62+

key: CapabilityProviderRegistryKey;

63+

env: NodeJS.ProcessEnv;

64+

providerId?: string;

65+

}): string {

66+

return JSON.stringify({

67+

key: params.key,

68+

providerId: params.providerId ?? "",

69+

env: buildPluginSnapshotCacheEnvKey(params.env),

70+

});

71+

}

72+73+

function getCachedCapabilityProviderPluginIds(params: {

74+

key: CapabilityProviderRegistryKey;

75+

cfg?: OpenClawConfig;

76+

env: NodeJS.ProcessEnv;

77+

providerId?: string;

78+

}): string[] | undefined {

79+

if (!params.cfg || !shouldUsePluginSnapshotCache(params.env)) {

80+

return undefined;

81+

}

82+

const envCache = capabilityProviderPluginIdCache.get(params.cfg)?.get(params.env);

83+

const cached = envCache?.get(buildCapabilityProviderPluginIdCacheKey(params));

84+

if (!cached || cached.expiresAt <= Date.now()) {

85+

return undefined;

86+

}

87+

return [...cached.pluginIds];

88+

}

89+90+

function memoizeCapabilityProviderPluginIds(params: {

91+

key: CapabilityProviderRegistryKey;

92+

cfg?: OpenClawConfig;

93+

env: NodeJS.ProcessEnv;

94+

providerId?: string;

95+

pluginIds: string[];

96+

}): void {

97+

if (!params.cfg || !shouldUsePluginSnapshotCache(params.env)) {

98+

return;

99+

}

100+

let configCache = capabilityProviderPluginIdCache.get(params.cfg);

101+

if (!configCache) {

102+

configCache = new WeakMap<

103+

NodeJS.ProcessEnv,

104+

Map<string, CapabilityProviderPluginIdCacheEntry>

105+

>();

106+

capabilityProviderPluginIdCache.set(params.cfg, configCache);

107+

}

108+

let envCache = configCache.get(params.env);

109+

if (!envCache) {

110+

envCache = new Map<string, CapabilityProviderPluginIdCacheEntry>();

111+

configCache.set(params.env, envCache);

112+

}

113+

envCache.set(buildCapabilityProviderPluginIdCacheKey(params), {

114+

expiresAt: Date.now() + resolvePluginSnapshotCacheTtlMs(params.env),

115+

pluginIds: [...params.pluginIds],

116+

});

117+

}

118+46119

function resolveBundledCapabilityCompatPluginIds(params: {

47120

key: CapabilityProviderRegistryKey;

48121

cfg?: OpenClawConfig;

49122

providerId?: string;

50123

}): string[] {

124+

const env = process.env;

125+

const cached = getCachedCapabilityProviderPluginIds({

126+

...params,

127+

env,

128+

});

129+

if (cached) {

130+

return cached;

131+

}

51132

const contractKey = CAPABILITY_CONTRACT_KEY[params.key];

52-

return loadPluginManifestRegistryForPluginRegistry({

133+

const pluginIds = loadPluginManifestRegistryForPluginRegistry({

53134

config: params.cfg,

54-

env: process.env,

135+

env,

55136

includeDisabled: true,

56137

})

57138

.plugins.filter(

@@ -62,6 +143,12 @@ function resolveBundledCapabilityCompatPluginIds(params: {

62143

)

63144

.map((plugin) => plugin.id)

64145

.toSorted((left, right) => left.localeCompare(right));

146+

memoizeCapabilityProviderPluginIds({

147+

...params,

148+

env,

149+

pluginIds,

150+

});

151+

return pluginIds;

65152

}

6615367154

function resolveCapabilityProviderConfig(params: {