fix(cli): bouton Send↔Stop #168 + collage clipboard fichier générique #155

This commit is contained in:
2026-08-06 20:00:36 +02:00
parent 292a81ee60
commit 8e97da57c9
5 changed files with 140 additions and 48 deletions

View File

@ -745,11 +745,18 @@ export class MockAgentGateway implements AgentGateway {
};
throw err;
}
// Singleton invariant: refuse a launch when the agent is already live in a
// *different* cell (mirrors the backend `AGENT_ALREADY_RUNNING`). The same
// node is allowed (idempotent re-launch of the very same cell).
// Singleton invariant for the human native TUI surface: refuse a launch when
// the agent already has a PTY in a different cell. Structured/headless
// sessions are separate surfaces and must not make the human TUI look
// "already active elsewhere" (#169/#170).
const liveNode = this.liveByAgent.get(agentId);
if (liveNode !== undefined && options.nodeId && liveNode !== options.nodeId) {
const liveKind = this.liveKindByAgent.get(agentId) ?? "pty";
if (
liveNode !== undefined &&
liveKind === "pty" &&
options.nodeId &&
liveNode !== options.nodeId
) {
const err: GatewayError = {
code: "AGENT_ALREADY_RUNNING",
message: `agent ${agentId} is already running in cell ${liveNode}`,
@ -814,7 +821,13 @@ export class MockAgentGateway implements AgentGateway {
} as GatewayError;
}
const liveNode = this.liveByAgent.get(agentId);
if (liveNode !== undefined && options.nodeId && liveNode !== options.nodeId) {
const liveKind = this.liveKindByAgent.get(agentId) ?? "pty";
if (
liveNode !== undefined &&
liveKind === "pty" &&
options.nodeId &&
liveNode !== options.nodeId
) {
throw {
code: "AGENT_ALREADY_RUNNING",
message: `agent ${agentId} is already running in cell ${liveNode}`,