fix(cli): les annonces MCP/inter-agent restent affichées pendant qu'un agent est busy — #232
This commit is contained in:
@ -96,6 +96,7 @@ async function seeded(profile: AgentProfile): Promise<Gateways> {
|
||||
const profileGateway = new MockProfileGateway();
|
||||
const terminal = new MockTerminalGateway();
|
||||
const system = new MockSystemGateway();
|
||||
const workState = new MockWorkStateGateway();
|
||||
await profileGateway.configureProfiles([profile]);
|
||||
const created = await agent.createAgent("p1", {
|
||||
name: "Worker",
|
||||
@ -114,6 +115,7 @@ async function seeded(profile: AgentProfile): Promise<Gateways> {
|
||||
profile: profileGateway,
|
||||
terminal,
|
||||
system,
|
||||
workState,
|
||||
} as unknown as Gateways;
|
||||
}
|
||||
|
||||
@ -180,6 +182,98 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
expect(screen.getAllByText(/mock-attachment.txt/).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("keeps the target announcement overlay visible in custom mode while busy (#232)", async () => {
|
||||
const gateways = await seeded(structuredProfile);
|
||||
const layout = gateways.layout as MockLayoutGateway;
|
||||
const workState = gateways.workState as MockWorkStateGateway;
|
||||
const tree = await layout.loadLayout("p1");
|
||||
const leaf = leaves(tree)[0];
|
||||
const agentId = leaf.agent;
|
||||
if (!agentId) throw new Error("expected seeded agent");
|
||||
window.localStorage.setItem(`idea.agent-cell-mode.p1.${leaf.id}`, "custom");
|
||||
workState._setProjectWorkState("p1", {
|
||||
agents: [
|
||||
{
|
||||
agentId,
|
||||
name: "Worker",
|
||||
profileId: structuredProfile.id,
|
||||
busy: { state: "busy", ticket: "ticket-232", sinceMs: 1 },
|
||||
tickets: [
|
||||
{
|
||||
ticketId: "ticket-232",
|
||||
conversationId: "conversation-232",
|
||||
position: 0,
|
||||
status: "inProgress",
|
||||
source: { kind: "agent", agentId: "main" },
|
||||
requesterLabel: "Main",
|
||||
taskPreview: "Analyse",
|
||||
taskLen: 7,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
conversations: [],
|
||||
});
|
||||
|
||||
renderGrid(gateways);
|
||||
|
||||
expect(await screen.findByTestId("custom-agent-chat-view")).toBeTruthy();
|
||||
expect(await screen.findByTestId("target-announcements-overlay")).toBeTruthy();
|
||||
expect(screen.getByText("Travaille sur une demande de Main.")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("renders requester-side delegation fallback in custom mode after remount (#232)", async () => {
|
||||
const gateways = await seeded(structuredProfile);
|
||||
const layout = gateways.layout as MockLayoutGateway;
|
||||
const workState = gateways.workState as MockWorkStateGateway;
|
||||
const tree = await layout.loadLayout("p1");
|
||||
const leaf = leaves(tree)[0];
|
||||
const requesterId = leaf.agent;
|
||||
if (!requesterId) throw new Error("expected seeded requester");
|
||||
window.localStorage.setItem(`idea.agent-cell-mode.p1.${leaf.id}`, "custom");
|
||||
workState._setProjectWorkState("p1", {
|
||||
agents: [
|
||||
{
|
||||
agentId: requesterId,
|
||||
name: "Worker",
|
||||
profileId: structuredProfile.id,
|
||||
busy: { state: "idle" },
|
||||
tickets: [],
|
||||
},
|
||||
{
|
||||
agentId: "target-agent",
|
||||
name: "Architect",
|
||||
profileId: structuredProfile.id,
|
||||
busy: { state: "busy", ticket: "ticket-232", sinceMs: 1 },
|
||||
tickets: [
|
||||
{
|
||||
ticketId: "ticket-232",
|
||||
conversationId: "conversation-232",
|
||||
position: 0,
|
||||
status: "inProgress",
|
||||
source: { kind: "agent", agentId: requesterId },
|
||||
requesterLabel: "Worker",
|
||||
taskPreview: "Répondre",
|
||||
taskLen: 8,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
conversations: [],
|
||||
});
|
||||
|
||||
const view = renderGrid(gateways);
|
||||
|
||||
expect(await screen.findByTestId("custom-agent-chat-view")).toBeTruthy();
|
||||
expect(await screen.findByText("Délégation en cours.")).toBeTruthy();
|
||||
|
||||
view.unmount();
|
||||
renderGrid(gateways);
|
||||
|
||||
expect(await screen.findByTestId("custom-agent-chat-view")).toBeTruthy();
|
||||
expect(await screen.findByText("Délégation en cours.")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("persists custom CLI composer height per layout cell", async () => {
|
||||
const rectSpy = vi
|
||||
.spyOn(HTMLElement.prototype, "getBoundingClientRect")
|
||||
|
||||
Reference in New Issue
Block a user