feat(plugins): load activation scope from plugin manifest

Plugins can now declare activationScope ("app" | "project") in their
manifest; loader/runtime honor it to defer activation of project-scoped
plugins until a project is focused instead of activating everything at
app bootstrap. Bumps sdk/IdeaSDK to the commit that adds the field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 14:44:08 +02:00
parent 863d9b7277
commit e2da2d911e
16 changed files with 513 additions and 34 deletions

View File

@ -217,13 +217,13 @@ pub use system_permissions::{
};
pub use plugin::{
ContentHash, CustomPluginLayout, PluginBundleUrl, PluginCapability, PluginCommandId,
PluginContributionSet, PluginDescriptor, PluginError, PluginId, PluginInstallSource,
PluginLayoutContribution, PluginLayoutType, PluginLifecycleState, PluginManifest,
PluginMcpServerContribution, PluginMcpServerId, PluginMcpServerSpec, PluginMcpStatus,
PluginMcpStatusSet, PluginMenuItemContribution, PluginPackageRef, PluginRegistry,
PluginRegistryEntry, PluginTopLevelMenuContribution, PluginTrustLevel, PluginVersion,
RelativePath, RemovalOutcome, StagedPluginPackage,
ContentHash, CustomPluginLayout, PluginActivationScope, PluginBundleUrl, PluginCapability,
PluginCommandId, PluginContributionSet, PluginDescriptor, PluginError, PluginId,
PluginInstallSource, PluginLayoutContribution, PluginLayoutType, PluginLifecycleState,
PluginManifest, PluginMcpServerContribution, PluginMcpServerId, PluginMcpServerSpec,
PluginMcpStatus, PluginMcpStatusSet, PluginMenuItemContribution, PluginPackageRef,
PluginRegistry, PluginRegistryEntry, PluginTopLevelMenuContribution, PluginTrustLevel,
PluginVersion, RelativePath, RemovalOutcome, StagedPluginPackage,
};
pub use sandbox::{

View File

@ -288,6 +288,22 @@ pub enum PluginCapability {
Tooling,
}
/// Manifest-declared runtime activation scope.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PluginActivationScope {
/// Activate at app bootstrap, without requiring a focused project.
App,
/// Wait until a project is focused before the first activation.
Project,
}
impl Default for PluginActivationScope {
fn default() -> Self {
Self::App
}
}
/// Plugin command id.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
@ -495,6 +511,9 @@ pub struct PluginManifest {
/// Capabilities.
#[serde(default)]
pub capabilities: Vec<PluginCapability>,
/// Activation scope. Missing in older manifests means app-level activation.
#[serde(default)]
pub activation_scope: PluginActivationScope,
/// Contributions.
pub contributes: PluginContributionSet,
}
@ -693,4 +712,13 @@ mod tests {
serde_json::json!(["ui", "mcp", "tooling"])
);
}
#[test]
fn plugin_activation_scope_defaults_to_app_and_serializes_public_names() {
assert_eq!(PluginActivationScope::default(), PluginActivationScope::App);
assert_eq!(
serde_json::to_value(PluginActivationScope::Project).unwrap(),
serde_json::json!("project")
);
}
}