
























@@ -34,6 +34,7 @@ export type ToolPolicyPipelineStep = {
3434stripPluginOnlyAllowlist?: boolean;
3535suppressUnavailableCoreToolWarning?: boolean;
3636suppressUnavailableCoreToolWarningAllowlist?: string[];
37+unavailableCoreToolReason?: string;
3738};
38393940export function buildDefaultToolPolicyPipelineSteps(params: {
@@ -50,16 +51,19 @@ export function buildDefaultToolPolicyPipelineSteps(params: {
5051groupPolicy?: ToolPolicyLike;
5152senderPolicy?: ToolPolicyLike;
5253agentId?: string;
54+unavailableCoreToolReason?: string;
5355}): ToolPolicyPipelineStep[] {
5456const agentId = params.agentId?.trim();
5557const profile = params.profile?.trim();
5658const providerProfile = params.providerProfile?.trim();
59+const unavailableCoreToolReason = params.unavailableCoreToolReason?.trim();
5760return [
5861{
5962policy: params.profilePolicy,
6063label: profile ? `tools.profile (${profile})` : "tools.profile",
6164stripPluginOnlyAllowlist: true,
6265suppressUnavailableCoreToolWarningAllowlist: params.profileUnavailableCoreWarningAllowlist,
66+ unavailableCoreToolReason,
6367},
6468{
6569policy: params.providerProfilePolicy,
@@ -69,25 +73,44 @@ export function buildDefaultToolPolicyPipelineSteps(params: {
6973stripPluginOnlyAllowlist: true,
7074suppressUnavailableCoreToolWarningAllowlist:
7175params.providerProfileUnavailableCoreWarningAllowlist,
76+ unavailableCoreToolReason,
77+},
78+{
79+policy: params.globalPolicy,
80+label: "tools.allow",
81+stripPluginOnlyAllowlist: true,
82+ unavailableCoreToolReason,
7283},
73-{ policy: params.globalPolicy, label: "tools.allow", stripPluginOnlyAllowlist: true },
7484{
7585policy: params.globalProviderPolicy,
7686label: "tools.byProvider.allow",
7787stripPluginOnlyAllowlist: true,
88+ unavailableCoreToolReason,
7889},
7990{
8091policy: params.agentPolicy,
8192label: agentId ? `agents.${agentId}.tools.allow` : "agent tools.allow",
8293stripPluginOnlyAllowlist: true,
94+ unavailableCoreToolReason,
8395},
8496{
8597policy: params.agentProviderPolicy,
8698label: agentId ? `agents.${agentId}.tools.byProvider.allow` : "agent tools.byProvider.allow",
8799stripPluginOnlyAllowlist: true,
100+ unavailableCoreToolReason,
101+},
102+{
103+policy: params.groupPolicy,
104+label: "group tools.allow",
105+stripPluginOnlyAllowlist: true,
106+ unavailableCoreToolReason,
107+},
108+{
109+policy: params.senderPolicy,
110+label: "tools.toolsBySender",
111+stripPluginOnlyAllowlist: true,
112+ unavailableCoreToolReason,
88113},
89-{ policy: params.groupPolicy, label: "group tools.allow", stripPluginOnlyAllowlist: true },
90-{ policy: params.senderPolicy, label: "tools.toolsBySender", stripPluginOnlyAllowlist: true },
91114];
92115}
93116@@ -145,6 +168,7 @@ export function applyToolPolicyPipeline(params: {
145168pluginOnlyAllowlist: resolved.pluginOnlyAllowlist,
146169hasGatedCoreEntries: warnableGatedCoreEntries.length > 0,
147170hasOtherEntries: otherEntries.length > 0,
171+unavailableCoreToolReason: step.unavailableCoreToolReason,
148172});
149173const warning = `tools: ${step.label} allowlist contains unknown entries (${entries}). ${suffix}`;
150174if (rememberToolPolicyWarning(warning)) {
@@ -172,15 +196,23 @@ function describeUnknownAllowlistSuffix(params: {
172196pluginOnlyAllowlist: boolean;
173197hasGatedCoreEntries: boolean;
174198hasOtherEntries: boolean;
199+unavailableCoreToolReason?: string;
175200}): string {
176201const preface = params.pluginOnlyAllowlist
177202 ? "Allowlist contains only plugin entries; core tools will not be available."
178203 : "";
204+const unavailableCoreToolReason = params.unavailableCoreToolReason?.trim();
205+const unavailableCoreDetail = unavailableCoreToolReason
206+ ? `These entries are shipped core tools but unavailable here: ${unavailableCoreToolReason}.`
207+ : "These entries are shipped core tools but unavailable in the current runtime/provider/model/config.";
208+const mixedUnavailableCoreDetail = unavailableCoreToolReason
209+ ? `Some entries are shipped core tools but unavailable here: ${unavailableCoreToolReason}; other entries won't match any tool unless the plugin is enabled.`
210+ : "Some entries are shipped core tools but unavailable in the current runtime/provider/model/config; other entries won't match any tool unless the plugin is enabled.";
179211const detail =
180212params.hasGatedCoreEntries && params.hasOtherEntries
181- ? "Some entries are shipped core tools but unavailable in the current runtime/provider/model/config; other entries won't match any tool unless the plugin is enabled."
213+ ? mixedUnavailableCoreDetail
182214 : params.hasGatedCoreEntries
183- ? "These entries are shipped core tools but unavailable in the current runtime/provider/model/config."
215+ ? unavailableCoreDetail
184216 : "These entries won't match any tool unless the plugin is enabled.";
185217return preface ? `${preface} ${detail}` : detail;
186218}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。