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:
2026-06-09 09:24:51 +02:00
parent 32398827fb
commit 785e9935fd
118 changed files with 5793 additions and 866 deletions

View File

@ -429,6 +429,57 @@ impl LayoutTree {
Ok(tree)
}
/// Attaches an existing live [`SessionId`] to `target`, moving it away from
/// any other visible leaf first.
///
/// This models the IdeA-first visible/background contract: a live agent
/// session may keep running while detached from the grid, and opening a cell
/// on that already-running session simply re-attaches its view. The session is
/// visible in at most one cell because any previous host is cleared before the
/// target is set.
///
/// Pure: returns a new validated tree.
///
/// # Errors
/// - [`LayoutError::NodeNotFound`] if `target` is not a leaf in the tree,
/// - [`LayoutError::CrossContainer`] if `target` hosts a different session.
pub fn attach_session(&self, target: NodeId, session: SessionId) -> Result<Self, LayoutError> {
let target_session = self.session_in_leaf(target)?;
if let Some(existing) = target_session {
if existing == session {
return Ok(self.clone());
}
return Err(LayoutError::CrossContainer);
}
let root = map_node(&self.root, &mut |node| {
if let LayoutNode::Leaf(leaf) = node {
if leaf.session == Some(session) && leaf.id != target {
return LayoutNode::Leaf(LeafCell {
id: leaf.id,
session: None,
agent: leaf.agent,
conversation_id: leaf.conversation_id.clone(),
agent_was_running: leaf.agent_was_running,
});
}
if leaf.id == target {
return LayoutNode::Leaf(LeafCell {
id: leaf.id,
session: Some(session),
agent: leaf.agent,
conversation_id: leaf.conversation_id.clone(),
agent_was_running: leaf.agent_was_running,
});
}
}
node.clone()
});
let tree = Self { root };
tree.validate()?;
Ok(tree)
}
/// Attaches (or, with `None`, detaches) an [`AgentId`] to the leaf `target`.
///
/// Records which agent should be auto-launched in the cell (feature #3).
@ -513,11 +564,7 @@ impl LayoutTree {
///
/// # Errors
/// - [`LayoutError::NodeNotFound`] if `target` is not a leaf in the tree.
pub fn set_agent_running(
&self,
target: NodeId,
running: bool,
) -> Result<Self, LayoutError> {
pub fn set_agent_running(&self, target: NodeId, running: bool) -> Result<Self, LayoutError> {
let mut found = false;
let root = map_node(&self.root, &mut |node| {
if let LayoutNode::Leaf(leaf) = node {
@ -580,9 +627,7 @@ impl LayoutTree {
match node {
LayoutNode::Leaf(leaf) if leaf.id == id => Some(leaf.session),
LayoutNode::Leaf(_) => None,
LayoutNode::Split(split) => {
split.children.iter().find_map(|c| find(&c.node, id))
}
LayoutNode::Split(split) => split.children.iter().find_map(|c| find(&c.node, id)),
LayoutNode::Grid(grid) => grid.cells.iter().find_map(|c| find(&c.node, id)),
}
}