Files
IdeA/.ideai/memory/b7-wiring-anchor-state-rs.md
Blomios ebd992e41a docs(memory): notes projet tâches de fond, tickets V1 et checkpoints ticket #1
Capitalise la mémoire projet accumulée pendant les chantiers B7/B8
(tâches de fond first-class), le système de tickets V1 et le ticket #1 :
design, cadrages d'archi, checkpoints d'avancement et verdicts QA/frontend.
Mise à jour de l'index MEMORY.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 00:21:43 +02:00

2.6 KiB

name, description, metadata
name description metadata
b7-wiring-anchor-state-rs memory note b7-wiring-anchor-state-rs
type
project

B7 — Ancre de câblage runtime (crates/app-tauri/src/state.rs)

Composition root = builder AppState dans crates/app-tauri/src/state.rs. Repères exacts (lecture Main 2026-07-02, base feature/background-tasks-first-class) :

  • Mailbox / inbox construits l.1207-1242 : InMemoryMailbox::new() (1207) → mailbox (1208, dyn AgentMailbox) → MediatedInbox::with_pty(...) (1213) → input_mediator (1242, dyn InputMediator). C'est LA file existante ; B4 (AgentInbox) s'y branche.
  • clock dispo : Arc<dyn Clock> (cloné partout, ex. 1255, 1384).
  • Pattern de boucle de fond OBLIGATOIRE : tauri::async_runtime::spawn (PAS tokio::spawnbuild tourne dans le hook setup sans runtime tokio ambiant). Exemples : sweep_stalled l.1234, drain scheduler session-limit l.1317. Le sink B3 + bridge B4 + wake B5 doivent être spawnés sur ce même pattern.
  • Builder OrchestratorService l.1356-1454 : chaîne .with_input_mediator (1369), .with_events, .with_record_turn, .with_live_state/.with_live_state_read (providers PAR ROOT, root fixée par appel), .with_ask_liveness_probe, .with_ask_ceiling, .with_structured (1453). ⚠ POINT CLÉ : .with_background_tasks(store, clock) de B6 N'EST PAS présent ici → le rendez-vous-as-task est DORMANT au runtime. B7 doit l'ajouter.
  • Nuance per-root : FsBackgroundTaskStore écrit <root>/.ideai/background-tasks/<projectId>.json (per-projet), mais OrchestratorService est GLOBAL multi-projets. Suivre le précédent AppLiveStateProvider / AppReconcileLiveState (provider keyé par root, câblé dans open_project, cf. commentaire l.1247-1252) plutôt qu'une instance de store globale unique.
  • Reconcile au boot : précédent = reconcile_live_state (l.1252) appelé dans open_project (commands.rs l.134). Le reconcile des tâches de fond + ré-enqueue des complétions non livrées peut se greffer au même endroit (per project root à l'ouverture).

Point d'accroche B8 (déféré, couplage PTY) : création commande longue côté pty.rs / LocalProcessSpawner → créer BackgroundTask{kind:Command} au spawn + pousser exit/stdout dans le sink.

Lien : background-tasks-first-class-design, checkpoint-b2-bootstrap-applied-await-codex-reset-1430.