mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(plugins): simplify CLI backend policy ownership
This commit is contained in:
@@ -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: [
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user