fix(plugins): simplify CLI backend policy ownership

This commit is contained in:
Vincent Koc
2026-06-16 18:50:25 +08:00
parent a8e0dc1bd8
commit 27ebfc7c4d
2 changed files with 5 additions and 15 deletions
@@ -237,9 +237,8 @@ describe("provider public artifacts", () => {
typeof import("./provider-public-artifacts.js")
>(import.meta.url, "./provider-public-artifacts.js?scope=provider-cli-backend");
// The anthropic plugin owns the "claude-cli" provider via cliBackends (not `providers`),
// so its bundled policy surface must resolve for claude-cli — otherwise claude-cli
// subagents silently fall back to the base thinking profile (capped at "high").
// CLI backend ids use the same provider-policy owner boundary as provider ids.
// Without it, claude-cli subagents fall back to the base thinking profile.
const surface = resolvePolicySurface("claude-cli", {
manifestRegistry: {
plugins: [
+3 -12
View File
@@ -106,23 +106,14 @@ function pluginOwnsProviderPolicyRef(
normalizedProviderId: string,
): boolean {
const ownedProviders = new Set(
plugin.providers.map((provider) => normalizeProviderId(provider)).filter(Boolean),
[...plugin.providers, ...plugin.cliBackends]
.map((provider) => normalizeProviderId(provider))
.filter(Boolean),
);
if (ownedProviders.has(normalizedProviderId)) {
return true;
}
// A plugin's policy surface also serves the CLI backends it declares (e.g. the anthropic
// plugin owns the "claude-cli" backend). Those backends are providers in their own right
// but have no standalone surface, so without this they resolve to no policy at all — which,
// in subagent sessions, silently caps their thinking profile at the base "high" ceiling.
const ownedCliBackends = new Set(
plugin.cliBackends.map((backend) => normalizeProviderId(backend)).filter(Boolean),
);
if (ownedCliBackends.has(normalizedProviderId)) {
return true;
}
for (const [rawAlias, rawTarget] of Object.entries(plugin.providerAuthAliases ?? {})) {
const alias = normalizeProviderId(rawAlias);
const target = normalizeProviderId(rawTarget);