feat(memory): config embedders (LOT C2) + suggestion contextuelle (LOT C3) + contexte projet partagé
- LOT C2 (§14.5.3) : use cases de configuration des embedders déclaratifs (List/Save/Delete + DescribeEmbedderEngines : modèles ONNX recommandés, environnement local détecté, stratégies compilées). UI EmbedderSettings. - LOT C3 (§14.5.5) : suggestion contextuelle best-effort à l'activation quand la mémoire dépasse le budget de recall sans embedder configuré (event EmbedderSuggested, anti-spam 1×/session, « ne plus demander »). - Contexte projet partagé .ideai/CONTEXT.md (model-agnostic) injecté à tous les agents/profils au lancement, avant la persona. UI ProjectContextPanel. Tests : backend workspace vert (0 échec) ; frontend 306/306. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -22,7 +22,8 @@ use domain::{Project, ProjectId, ProjectPath, RemoteRef};
|
||||
|
||||
use application::{
|
||||
CloseProject, CloseProjectInput, CloseTab, CloseTabInput, CreateProject, CreateProjectInput,
|
||||
ListProjects, OpenProject, OpenProjectInput,
|
||||
ListProjects, OpenProject, OpenProjectInput, ReadProjectContext, ReadProjectContextInput,
|
||||
UpdateProjectContext, UpdateProjectContextInput,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -75,11 +76,7 @@ impl FileSystem for FakeFs {
|
||||
}
|
||||
|
||||
async fn create_dir_all(&self, path: &RemotePath) -> Result<(), FsError> {
|
||||
self.0
|
||||
.lock()
|
||||
.unwrap()
|
||||
.dirs
|
||||
.insert(path.as_str().to_owned());
|
||||
self.0.lock().unwrap().dirs.insert(path.as_str().to_owned());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -221,6 +218,8 @@ struct Env {
|
||||
bus: SpyBus,
|
||||
create: CreateProject,
|
||||
open: OpenProject,
|
||||
read_context: ReadProjectContext,
|
||||
update_context: UpdateProjectContext,
|
||||
}
|
||||
|
||||
fn env() -> Env {
|
||||
@ -238,6 +237,8 @@ fn env() -> Env {
|
||||
Arc::new(bus.clone()),
|
||||
);
|
||||
let open = OpenProject::new(Arc::new(store.clone()), Arc::new(fs.clone()));
|
||||
let read_context = ReadProjectContext::new(Arc::new(fs.clone()));
|
||||
let update_context = UpdateProjectContext::new(Arc::new(fs.clone()));
|
||||
|
||||
Env {
|
||||
store,
|
||||
@ -245,6 +246,8 @@ fn env() -> Env {
|
||||
bus,
|
||||
create,
|
||||
open,
|
||||
read_context,
|
||||
update_context,
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,6 +304,44 @@ async fn create_registers_project_in_store() {
|
||||
assert_eq!(stored[0].name, "Demo");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn project_context_lives_under_ideai_and_missing_reads_empty() {
|
||||
let env = env();
|
||||
let out = env.create.execute(input("Demo", "/p")).await.unwrap();
|
||||
|
||||
let missing = env
|
||||
.read_context
|
||||
.execute(ReadProjectContextInput {
|
||||
project: out.project.clone(),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(missing.content, "");
|
||||
|
||||
env.update_context
|
||||
.execute(UpdateProjectContextInput {
|
||||
project: out.project.clone(),
|
||||
content: "# Shared\n\nUse pnpm.".to_owned(),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let bytes = env
|
||||
.fs
|
||||
.read_file("/p/.ideai/CONTEXT.md")
|
||||
.expect("project context written under .ideai");
|
||||
assert_eq!(String::from_utf8(bytes).unwrap(), "# Shared\n\nUse pnpm.");
|
||||
|
||||
let read_back = env
|
||||
.read_context
|
||||
.execute(ReadProjectContextInput {
|
||||
project: out.project,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(read_back.content, "# Shared\n\nUse pnpm.");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn create_publishes_project_created_event() {
|
||||
let env = env();
|
||||
@ -543,7 +584,10 @@ async fn close_without_workspace_skips_persistence() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(store.saved_workspace().is_none(), "no persistence when None");
|
||||
assert!(
|
||||
store.saved_workspace().is_none(),
|
||||
"no persistence when None"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user