diff --git a/frontend/src/features/agents/CustomAgentChatView.tsx b/frontend/src/features/agents/CustomAgentChatView.tsx index 2894fcbe..78647140 100644 --- a/frontend/src/features/agents/CustomAgentChatView.tsx +++ b/frontend/src/features/agents/CustomAgentChatView.tsx @@ -44,7 +44,7 @@ export interface CustomAgentChatViewProps { profile: AgentProfile; cwd: string; layoutId?: string; - nodeId: string; + nodeId?: string; sessionId: string | null; conversationId: string | null; composerHeightPx?: number; @@ -125,6 +125,11 @@ function describe(e: unknown): string { return String(e); } +function describeOpenFailure(e: unknown, mobile: boolean): string { + if (!mobile) return describe(e); + return "Le CLI custom n'a pas pu démarrer. Vérifiez la configuration du profil ou utilisez la TUI native."; +} + function instrumentationError(e: unknown): Record { if (e && typeof e === "object") { const err = e as GatewayError & { name?: string }; @@ -803,6 +808,7 @@ export function CustomAgentChatView({ onSessionIdRef.current = onSessionId; const onConversationIdRef = useRef(onConversationId); onConversationIdRef.current = onConversationId; + const domId = nodeId ?? `agent-${agentId}`; const clampComposerHeight = useCallback( (heightPx: number): number => { @@ -891,7 +897,7 @@ export function CustomAgentChatView({ const slashPrefix = slashCommandPrefix(draft); const draftScope = useMemo(() => { if (explicitDraftScope) return explicitDraftScope; - return layoutId ? { projectId, layoutId, nodeId } : null; + return layoutId && nodeId ? { projectId, layoutId, nodeId } : null; }, [explicitDraftScope, layoutId, nodeId, projectId]); const currentConversationCacheKey = useMemo( () => conversationCacheKey(projectId, agentId, conversationId), @@ -1173,7 +1179,7 @@ export function CustomAgentChatView({ options.conversationId === undefined ? conversationId ?? undefined : options.conversationId ?? undefined, - nodeId, + ...(nodeId ? { nodeId } : {}), }; console.debug("[ticket149] recoverStructuredSession:launchAgentChat:start", { timestamp: new Date().toISOString(), @@ -1365,7 +1371,7 @@ export function CustomAgentChatView({ sessionId: externalSessionId, error: instrumentationError(e), }); - if (!cancelled) setError(describe(e)); + if (!cancelled) setError(describeOpenFailure(e, mobile)); } finally { if (!cancelled) setOpening(false); } @@ -1384,6 +1390,7 @@ export function CustomAgentChatView({ applyChatViewState, currentConversationCacheKey, conversationId, + mobile, ]); const canSend = useMemo( @@ -1822,7 +1829,7 @@ export function CustomAgentChatView({

Changer de profil @@ -1979,7 +1986,7 @@ export function CustomAgentChatView({ )} {slashMenuOpen && slashCommands.length > 0 && (