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

@ -313,6 +313,65 @@ export interface MemoryIndexEntry {
/** A resolved `[[wikilink]]` target — the slug of another note. */
export type MemoryLink = string;
// ---------------------------------------------------------------------------
// Embedder (L14 / lot C2) — mirror of the backend `EmbedderProfileDto` and
// `EmbedderEnginesDto`. Drives the memory/embedder settings panel. Identity of
// a profile is its `id`; changing the active embedder takes effect at the next
// app start (the UI says so explicitly).
// ---------------------------------------------------------------------------
/**
* Embedding strategy of an embedder profile (mirror of the backend `strategy`).
* `none` ⇒ no vector tier (naïve recall); the other strategies select where the
* embeddings come from.
*/
export type EmbedderStrategy = "localOnnx" | "localServer" | "api" | "none";
/**
* A declarative embedder profile (mirror of the backend `EmbedderProfile` DTO,
* camelCase wire format). Transparent by design: secrets are never stored here —
* `apiKeyEnv` is the *name* of an environment variable, never the key itself.
*/
export interface EmbedderProfile {
id: string;
name: string;
strategy: EmbedderStrategy;
/** Model id/name (ONNX model, server/api model). Omitted for `none`. */
model?: string;
/** Server/API endpoint URL. Omitted for `localOnnx` / `none`. */
endpoint?: string;
/** Name of the env var holding the API key (api strategy). Never the key. */
apiKeyEnv?: string;
/** Embedding vector dimension. */
dimension: number;
}
/**
* A recommended local ONNX engine (mirror of the backend `recommendedOnnx`
* entry). `e5-small` is the curated default (`recommended: true`).
*/
export interface RecommendedOnnxEngine {
id: string;
displayName: string;
dimension: number;
approxSizeMb: number;
recommended: boolean;
}
/**
* Capabilities/availability snapshot of the embedder engines on this build
* (mirror of the backend `describe_embedder_engines`). The `vector*Enabled`
* flags reflect Cargo feature flags compiled into the build: a strategy whose
* flag is `false` is shown disabled ("not available in this build").
*/
export interface EmbedderEngines {
recommendedOnnx: RecommendedOnnxEngine[];
ollamaDetected: boolean;
onnxCachedModels: string[];
vectorHttpEnabled: boolean;
vectorOnnxEnabled: boolean;
}
// ---------------------------------------------------------------------------
// Templates (L7) — mirror of the domain `Template` / `AgentDrift`.
// ---------------------------------------------------------------------------