feat(terminals): durcit le portail d'écriture de délégation

Fiabilise la livraison des délégations inter-agents dans le terminal :
écriture par chunks UTF-8 bornés (512 o, délai 8 ms) pour éviter les
comportements de paste/drop des TUI sur agents froids, et réconciliation
de l'attachement front (frontAttachedAgentRef / reconcileFrontAttachment)
pour ne reporter « front attaché » qu'une fois les DelegationReady
réellement consommés. Tests vitest associés.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 08:56:26 +02:00
parent 287681c198
commit e462136df2
3 changed files with 149 additions and 26 deletions

View File

@ -28,11 +28,11 @@
* - getByRole("alert") — error display
*/
import { useState } from "react";
import { useEffect, useState } from "react";
import type { LayoutInfo } from "@/domain";
import { LayoutGrid, LayoutTabs } from "@/features/layout";
import { AgentsPanel, ResumeProjectPanel } from "@/features/agents";
import { AgentsPanel } from "@/features/agents";
import { TemplatesPanel } from "@/features/templates";
import { SkillsPanel } from "@/features/skills";
import { MemoryPanel } from "@/features/memory";
@ -79,6 +79,15 @@ export function ProjectsView() {
const active = vm.openTabs.find((t) => t.id === vm.activeTabId) ?? null;
// Reset the active layout whenever the active project changes. `activeLayout`
// is only repopulated asynchronously by `LayoutTabs` (which re-fetches the new
// project's layouts). Without this reset, the stale id of the *previous*
// project would be handed to `LayoutGrid`/`GitGraphView` during the gap, and
// loading it against the new project's store fails with "not found: layout X".
useEffect(() => {
setActiveLayout(null);
}, [active?.id]);
const activeLayoutKind = activeLayout?.kind ?? "terminal";
const canCreate = name.trim().length > 0 && root.trim().length > 0 && !vm.busy;
@ -355,17 +364,6 @@ export function ProjectsView() {
)}
</main>
</div>
{/* ── Reopen resume panel (§15.2) ──
Mounted per active project (keyed by id) so it re-pulls the resumable
inventory on every open/switch; it renders nothing when empty. */}
{active && (
<ResumeProjectPanel
key={`resume-${active.id}`}
projectId={active.id}
cwd={active.root}
/>
)}
</div>
);
}