



























@@ -30,16 +30,6 @@ const STATIC_AGENT_RUNTIME_BASE_TARGET_IDS = [
3030"messages.tts.providers.*.apiKey",
3131"skills.entries.*.apiKey",
3232"tools.web.search.apiKey",
33-"plugins.entries.brave.config.webSearch.apiKey",
34-"plugins.entries.google.config.webSearch.apiKey",
35-"plugins.entries.exa.config.webSearch.apiKey",
36-"plugins.entries.xai.config.webSearch.apiKey",
37-"plugins.entries.moonshot.config.webSearch.apiKey",
38-"plugins.entries.perplexity.config.webSearch.apiKey",
39-"plugins.entries.firecrawl.config.webSearch.apiKey",
40-"plugins.entries.firecrawl.config.webFetch.apiKey",
41-"plugins.entries.tavily.config.webSearch.apiKey",
42-"plugins.entries.minimax.config.webSearch.apiKey",
4333] as const;
4434const STATIC_STATUS_TARGET_IDS = [
4535"agents.defaults.memorySearch.remote.apiKey",
@@ -67,13 +57,34 @@ type CommandSecretTargets = {
6757};
68586959let cachedCommandSecretTargets: CommandSecretTargets | undefined;
60+let cachedAgentRuntimeBaseTargetIds: string[] | undefined;
7061let cachedChannelSecretTargetIds: string[] | undefined;
71627263function getChannelSecretTargetIds(): string[] {
7364cachedChannelSecretTargetIds ??= idsByPrefix(["channels."]);
7465return cachedChannelSecretTargetIds;
7566}
766768+function isPluginWebCredentialTargetId(id: string): boolean {
69+const segments = id.split(".");
70+if (segments[0] !== "plugins" || segments[1] !== "entries" || segments[3] !== "config") {
71+return false;
72+}
73+const configPath = segments.slice(4).join(".");
74+return configPath === "webSearch.apiKey" || configPath === "webFetch.apiKey";
75+}
76+77+function getAgentRuntimeBaseTargetIds(): string[] {
78+cachedAgentRuntimeBaseTargetIds ??= [
79+ ...STATIC_AGENT_RUNTIME_BASE_TARGET_IDS,
80+ ...listSecretTargetRegistryEntries()
81+.map((entry) => entry.id)
82+.filter(isPluginWebCredentialTargetId)
83+.toSorted(),
84+];
85+return cachedAgentRuntimeBaseTargetIds;
86+}
87+7788function isScopedChannelSecretTargetEntry(params: {
7889entry: {
7990id: string;
@@ -120,7 +131,7 @@ function buildCommandSecretTargets(): CommandSecretTargets {
120131const channelTargetIds = getChannelSecretTargetIds();
121132return {
122133channels: channelTargetIds,
123-agentRuntime: [...STATIC_AGENT_RUNTIME_BASE_TARGET_IDS, ...channelTargetIds],
134+agentRuntime: [...getAgentRuntimeBaseTargetIds(), ...channelTargetIds],
124135status: [...STATIC_STATUS_TARGET_IDS, ...channelTargetIds],
125136securityAudit: [...STATIC_SECURITY_AUDIT_TARGET_IDS, ...channelTargetIds],
126137};
@@ -213,7 +224,7 @@ export function getAgentRuntimeCommandSecretTargetIds(params?: {
213224includeChannelTargets?: boolean;
214225}): Set<string> {
215226if (params?.includeChannelTargets !== true) {
216-return toTargetIdSet(STATIC_AGENT_RUNTIME_BASE_TARGET_IDS);
227+return toTargetIdSet(getAgentRuntimeBaseTargetIds());
217228}
218229return toTargetIdSet(getCommandSecretTargets().agentRuntime);
219230}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。