feat(plugins): paramètres projet plugins + attribution skills/tools aux agents — #282 (manifeste accepte contributes.skills IdeA-native multi-harness; store .ideai/project-plugins.json v1: enable plugin par projet + assignments skills/tools par agent; refs + use cases settings/assign/unassign; resolver skills pour idea_skill_read et injection catalogue lancement agent; permissions MCP dynamiques projetées par harness Claude Code/Codex/OpenCode; tombstones uninstall, hot reload recalcule catalogue et marque assignments cassés; frontend: Settings projet Plugins, détail capabilities, attribution agent, catalogue permissions; bump pointeur IdeaSDK 6eb8db3; QA verte: cargo test -p application, project_plugin_settings 3/3, dto_plugins 2/2, structured_launch_d3 26/26, catalogue mcp 7/7, frontend 5 tests ProjectPluginSettings/plugin, npm build frontend)
This commit is contained in:
@ -110,6 +110,7 @@ pub use sandbox::{default_enforcer, NoopSandbox};
|
||||
pub use scheduler::TokioScheduler;
|
||||
pub use session::{ClaudeSdkSession, CodexExecSession, FakeCli, StructuredSessionFactory};
|
||||
pub use sprints::FsSprintStore;
|
||||
pub use store::FsProjectPluginSettingsStore;
|
||||
#[cfg(feature = "vector-onnx")]
|
||||
pub use store::OnnxEmbedder;
|
||||
#[cfg(feature = "vector-http")]
|
||||
|
||||
@ -155,6 +155,21 @@ impl PluginPackageStore for FsPluginPackageStore {
|
||||
Ok(PluginManifestBytes { bytes })
|
||||
}
|
||||
|
||||
async fn read_installed_file(
|
||||
&self,
|
||||
plugin_id: &PluginId,
|
||||
path: &RelativePath,
|
||||
) -> Result<Vec<u8>, PluginStoreError> {
|
||||
let resolved = self.resolve_asset_path(plugin_id, path)?;
|
||||
fs::read(resolved).map_err(|e| {
|
||||
if e.kind() == io::ErrorKind::NotFound {
|
||||
PluginStoreError::NotFound
|
||||
} else {
|
||||
PluginStoreError::Io(e.to_string())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async fn install_from_archive(
|
||||
&self,
|
||||
archive: &LocalPath,
|
||||
|
||||
@ -14,6 +14,7 @@ mod memory;
|
||||
mod permission;
|
||||
mod profile;
|
||||
mod project;
|
||||
mod project_plugin;
|
||||
mod secrets;
|
||||
mod skill;
|
||||
mod system_permission;
|
||||
@ -39,6 +40,7 @@ pub use memory::{index_token_size, FsMemoryStore, NaiveMemoryRecall};
|
||||
pub use permission::FsPermissionStore;
|
||||
pub use profile::{FsEmbedderProfileStore, FsProfileStore};
|
||||
pub use project::FsProjectStore;
|
||||
pub use project_plugin::FsProjectPluginSettingsStore;
|
||||
pub use secrets::FsSecretStore;
|
||||
pub use skill::FsSkillStore;
|
||||
pub use system_permission::FsSystemPermissionStore;
|
||||
|
||||
76
crates/infrastructure/src/store/project_plugin.rs
Normal file
76
crates/infrastructure/src/store/project_plugin.rs
Normal file
@ -0,0 +1,76 @@
|
||||
//! Project-scoped plugin activation and assignment persistence.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use domain::{
|
||||
FileSystem, FsError, ProjectPath, ProjectPluginSettings, ProjectPluginSettingsStore,
|
||||
RemotePath, StoreError,
|
||||
};
|
||||
|
||||
const SETTINGS_FILE: &str = ".ideai/project-plugins.json";
|
||||
|
||||
/// File-backed settings store using the project's location-neutral filesystem.
|
||||
#[derive(Clone)]
|
||||
pub struct FsProjectPluginSettingsStore {
|
||||
fs: Arc<dyn FileSystem>,
|
||||
}
|
||||
|
||||
impl FsProjectPluginSettingsStore {
|
||||
/// Builds the adapter.
|
||||
#[must_use]
|
||||
pub fn new(fs: Arc<dyn FileSystem>) -> Self {
|
||||
Self { fs }
|
||||
}
|
||||
|
||||
fn path(project_root: &ProjectPath) -> RemotePath {
|
||||
RemotePath::new(format!(
|
||||
"{}/{}",
|
||||
project_root.as_str().trim_end_matches(['/', '\\']),
|
||||
SETTINGS_FILE
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ProjectPluginSettingsStore for FsProjectPluginSettingsStore {
|
||||
async fn load(&self, project_root: &ProjectPath) -> Result<ProjectPluginSettings, StoreError> {
|
||||
match self.fs.read(&Self::path(project_root)).await {
|
||||
Ok(bytes) => {
|
||||
let settings: ProjectPluginSettings = serde_json::from_slice(&bytes)
|
||||
.map_err(|e| StoreError::Serialization(e.to_string()))?;
|
||||
if settings.version != 1 {
|
||||
return Err(StoreError::Invalid(format!(
|
||||
"unsupported project plugin settings version {}",
|
||||
settings.version
|
||||
)));
|
||||
}
|
||||
Ok(settings)
|
||||
}
|
||||
Err(FsError::NotFound(_)) => Ok(ProjectPluginSettings::default()),
|
||||
Err(e) => Err(StoreError::Io(e.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
async fn save(
|
||||
&self,
|
||||
project_root: &ProjectPath,
|
||||
settings: &ProjectPluginSettings,
|
||||
) -> Result<(), StoreError> {
|
||||
let dir = RemotePath::new(format!(
|
||||
"{}/.ideai",
|
||||
project_root.as_str().trim_end_matches(['/', '\\'])
|
||||
));
|
||||
self.fs
|
||||
.create_dir_all(&dir)
|
||||
.await
|
||||
.map_err(|e| StoreError::Io(e.to_string()))?;
|
||||
let mut bytes = serde_json::to_vec_pretty(settings)
|
||||
.map_err(|e| StoreError::Serialization(e.to_string()))?;
|
||||
bytes.push(b'\n');
|
||||
self.fs
|
||||
.write(&Self::path(project_root), &bytes)
|
||||
.await
|
||||
.map_err(|e| StoreError::Io(e.to_string()))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user