feat(workstate): UI des actions contrôlées (Lot D frontend)

Câble les actions contrôlées dans ProjectWorkStatePanel : port et adaptateur
agent étendus aux nouvelles commandes, adaptateur mock aligné.

Tests verts : workstate + projects (25), agent (8), singletonAgent +
agentAlreadyRunning (9), tsc --noEmit OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 19:51:52 +02:00
parent 3408c96974
commit 1c6441bb35
8 changed files with 611 additions and 33 deletions

View File

@ -61,6 +61,7 @@ import type {
ReattachResult,
RemoteGateway,
SkillGateway,
StoppedLiveAgent,
SystemGateway,
TemplateGateway,
TerminalGateway,
@ -215,7 +216,8 @@ export class MockAgentGateway implements AgentGateway {
.map(([agentId, nodeId]) => ({
agentId,
nodeId,
sessionId: this.liveSessionByAgent.get(agentId),
sessionId: this.liveSessionByAgent.get(agentId)!,
kind: "pty" as const,
}));
}
@ -256,7 +258,32 @@ export class MockAgentGateway implements AgentGateway {
throw err;
}
this.liveByAgent.set(agentId, nodeId);
return { agentId, nodeId, sessionId };
return { agentId, nodeId, sessionId, kind: "pty" };
}
async stopLiveAgent(projectId: string, agentId: string): Promise<StoppedLiveAgent> {
const list = this.getAgents(projectId);
if (!list.some((a) => a.id === agentId)) {
const err: GatewayError = {
code: "NOT_FOUND",
message: `agent ${agentId} not found in project ${projectId}`,
};
throw err;
}
const sessionId = this.liveSessionByAgent.get(agentId);
if (!sessionId) {
const err: GatewayError = {
code: "NOT_FOUND",
message: `agent ${agentId} has no live session`,
};
throw err;
}
const session = this.sessions.get(sessionId);
if (session) session.closed = true;
this.sessions.delete(sessionId);
this.liveSessionByAgent.delete(agentId);
this.liveByAgent.delete(agentId);
return { agentId, sessionId, kind: "pty" };
}
async createAgent(projectId: string, input: CreateAgentInput): Promise<Agent> {