From 75e13d7ba8bf272c6e377b902ed9e88ba00a7972 Mon Sep 17 00:00:00 2001 From: Lifei Zhou Date: Mon, 19 Oct 2026 23:17:47 +0000 Subject: [PATCH] ui (subagent): Show subagent session link and make subagent sessions view-only (#12998) --- crates/goose/src/acp/server.rs | 4 +- crates/goose/src/acp/server/load_session.rs | 36 ++--- .../src/acp/server/tool_calls/conversion.rs | 52 +++++-- .../src/agents/extension_manager/lease.rs | 7 +- .../goose/src/agents/extension_manager/mod.rs | 95 +++++++++++++ crates/goose/tests/acp_server_test.rs | 59 ++++++++ .../sessionNotificationAdapter.test.ts | 22 ++- ui/desktop/src/acp/adapter/tools.ts | 43 +++--- ui/desktop/src/components/BaseChat.tsx | 132 ++++++++++-------- .../components/SubagentSessionNotice.test.tsx | 27 ++++ .../src/components/SubagentSessionNotice.tsx | 40 ++++++ .../src/components/UserMessage.test.tsx | 29 ++++ ui/desktop/src/components/UserMessage.tsx | 38 ++--- .../src/components/rtlChatDirection.test.tsx | 2 +- ui/desktop/src/hooks/useChatSession.ts | 6 + ui/desktop/src/hooks/useChatSessionTypes.ts | 1 + ui/desktop/src/i18n/messages/de.json | 6 + ui/desktop/src/i18n/messages/en.json | 6 + ui/desktop/src/i18n/messages/es.json | 6 + ui/desktop/src/i18n/messages/fr.json | 6 + ui/desktop/src/i18n/messages/hi.json | 6 + ui/desktop/src/i18n/messages/id.json | 6 + ui/desktop/src/i18n/messages/it.json | 6 + ui/desktop/src/i18n/messages/ja.json | 6 + ui/desktop/src/i18n/messages/ko.json | 6 + ui/desktop/src/i18n/messages/ms.json | 6 + ui/desktop/src/i18n/messages/pt.json | 6 + ui/desktop/src/i18n/messages/ru.json | 6 + ui/desktop/src/i18n/messages/tr.json | 6 + ui/desktop/src/i18n/messages/vi.json | 6 + ui/desktop/src/i18n/messages/zh-CN.json | 6 + ui/desktop/src/i18n/messages/zh-TW.json | 6 + 32 files changed, 551 insertions(+), 138 deletions(-) create mode 100644 ui/desktop/src/components/SubagentSessionNotice.test.tsx create mode 100644 ui/desktop/src/components/SubagentSessionNotice.tsx create mode 100644 ui/desktop/src/components/UserMessage.test.tsx diff --git a/crates/goose/src/acp/server.rs b/crates/goose/src/acp/server.rs index 2d84d750b..98108a27a 100644 --- a/crates/goose/src/acp/server.rs +++ b/crates/goose/src/acp/server.rs @@ -92,7 +92,7 @@ use self::message_meta::{ use self::tool_calls::chain::{breaks_consecutive_tool_calls, ReadyToolChain, ToolChainTracker}; use self::tool_calls::conversion::{ build_initial_tool_call_with_message_meta, build_permission_tool_call_update, - tool_call_update_fields_from_response, trusted_update_meta, + tool_call_update_fields_from_response, tool_response_meta, }; use self::tool_calls::enrichment::{spawn_chain_summary_enrichment, spawn_tool_title_enrichment}; @@ -1540,7 +1540,7 @@ impl GooseAcpAgent { let fields = tool_call_update_fields_from_response(tool_response, tool_request, false); let update = ToolCallUpdate::new(ToolCallId::new(tool_response.id.clone()), fields) - .meta(trusted_update_meta(tool_response)); + .meta(tool_response_meta(tool_response)); let tool_call_notifier = ToolCallNotifier::new(cx, session_id); tool_call_notifier.send_update(update)?; diff --git a/crates/goose/src/acp/server/load_session.rs b/crates/goose/src/acp/server/load_session.rs index 845c2f7f5..99b2f452d 100644 --- a/crates/goose/src/acp/server/load_session.rs +++ b/crates/goose/src/acp/server/load_session.rs @@ -3,7 +3,7 @@ use super::message_meta::{ }; use super::tool_calls::conversion::{ build_initial_tool_call_with_message_meta, tool_call_update_fields_from_response, - trusted_update_meta, + tool_response_meta, }; use super::tool_calls::enrichment::tool_chain_summary; use super::*; @@ -172,7 +172,7 @@ fn replay_conversation_to_client( replay_tool_requests.get(&tool_response.id), true, ); - let meta = trusted_update_meta(tool_response).unwrap_or_default(); + let meta = tool_response_meta(tool_response).unwrap_or_default(); let update = ToolCallUpdate::new(ToolCallId::new(tool_response.id.clone()), fields) @@ -411,6 +411,16 @@ impl GooseAcpAgent { self.requests_tool_call_label_enrichment(), replay_tail_from_meta(args.meta.as_ref()), )?; + let pending_confirmations = session + .conversation + .as_ref() + .map(pending_tool_confirmations) + .unwrap_or_default(); + let awaiting_confirmation = !pending_confirmations.is_empty() + || session + .conversation + .as_ref() + .is_some_and(has_unapplied_tool_confirmation_response); let (agent, extension_results) = self.prepare_acp_session_agent(cx, &session).await?; self.register_acp_session(session_id_str.clone(), agent.clone()) .await; @@ -446,17 +456,9 @@ impl GooseAcpAgent { } response = response.meta(meta); - let pending_confirmations = session - .conversation - .as_ref() - .map(pending_tool_confirmations) - .unwrap_or_default(); - let should_resume_state_machine = !pending_confirmations.is_empty() - || session - .conversation - .as_ref() - .is_some_and(has_unapplied_tool_confirmation_response); - if should_resume_state_machine { + let is_subagent = session.session_type == SessionType::SubAgent; + let already_running = self.active_runs.agent_run(&session_id_str).is_some(); + if awaiting_confirmation && !is_subagent && !already_running { self.start_resumed_state_machine_turn( cx, &agent, @@ -464,14 +466,6 @@ impl GooseAcpAgent { &pending_confirmations, ) .await?; - } else { - self.resend_pending_tool_permissions( - cx, - &agent, - &session_id_str, - &pending_confirmations, - None, - )?; } self.closed_session_ids.lock().await.remove(&session_id_str); diff --git a/crates/goose/src/acp/server/tool_calls/conversion.rs b/crates/goose/src/acp/server/tool_calls/conversion.rs index bd1c14c76..c68d03616 100644 --- a/crates/goose/src/acp/server/tool_calls/conversion.rs +++ b/crates/goose/src/acp/server/tool_calls/conversion.rs @@ -213,16 +213,29 @@ fn extract_tool_locations_from_request(tool_request: &ToolRequest) -> Vec Option { +pub(crate) fn tool_response_meta(tool_response: &ToolResponse) -> Option { let tool_result = tool_response.tool_result.as_ref().ok()?; - let goose_meta = tool_result - .meta - .as_ref()? + let result_meta = tool_result.meta.as_ref()?; + let mut goose_meta = result_meta .0 - .get(TRUSTED_TOOL_UPDATE_META_KEY)? - .clone(); + .get(TRUSTED_TOOL_UPDATE_META_KEY) + .and_then(serde_json::Value::as_object) + .cloned() + .unwrap_or_default(); + + if let Some(subagent_id) = result_meta + .0 + .get("subagent_session_id") + .and_then(serde_json::Value::as_str) + { + goose_meta.insert("subagentSessionId".to_string(), subagent_id.into()); + } + + if goose_meta.is_empty() { + return None; + } let mut meta_map = serde_json::Map::new(); - meta_map.insert("goose".to_string(), goose_meta); + meta_map.insert("goose".to_string(), serde_json::Value::Object(goose_meta)); Some(meta_map) } @@ -720,9 +733,24 @@ mod tests { .map(|locs| locs.into_iter().map(|loc| (loc.path, loc.line)).collect()) } - mod trusted_update_meta { + mod tool_response_meta { use super::*; + #[test] + fn forwards_subagent_session_id() { + let response = response_with_meta(Some(serde_json::json!({ + "subagent_session_id": "child-session", + "foreground_subagent": true, + "unrelated": "not forwarded", + }))); + + let meta = tool_response_meta(&response).expect("expected subagent metadata"); + assert_eq!( + serde_json::Value::Object(meta), + serde_json::json!({"goose": {"subagentSessionId": "child-session"}}), + ); + } + #[test] fn ignores_untrusted_goose_meta() { let response = response_with_meta(Some(serde_json::json!({ @@ -733,12 +761,13 @@ mod tests { }, }))); - assert_eq!(trusted_update_meta(&response), None); + assert_eq!(tool_response_meta(&response), None); } #[test] - fn uses_trusted_meta_only() { + fn preserves_trusted_app_meta_alongside_subagent_session() { let response = response_with_meta(Some(serde_json::json!({ + "subagent_session_id": "child-session", "goose": { "mcpApp": { "resourceUri": "ui://spoofed/app", @@ -753,10 +782,11 @@ mod tests { }, }))); - let extracted = trusted_update_meta(&response).expect("expected trusted meta"); + let extracted = tool_response_meta(&response).expect("expected trusted meta"); assert_eq!( extracted.get("goose"), Some(&serde_json::json!({ + "subagentSessionId": "child-session", "mcpApp": { "resourceUri": "ui://trusted/app", "extensionName": "weather", diff --git a/crates/goose/src/agents/extension_manager/lease.rs b/crates/goose/src/agents/extension_manager/lease.rs index 8627f8965..4653637ae 100644 --- a/crates/goose/src/agents/extension_manager/lease.rs +++ b/crates/goose/src/agents/extension_manager/lease.rs @@ -23,9 +23,9 @@ use tracing::warn; use super::{ get_tool_meta_value, get_tool_owner, get_tool_resource_uri, insert_trusted_tool_update_meta, - recover_mangled_tool_name, remove_untrusted_mcp_app_meta, ActionRequiredStream, Extension, - ExtensionLoadResult, ExtensionMutation, ExtensionSlot, GooseMcpAppToolAttachment, - TOOL_CALL_NOTIFICATION_CHANNEL_CAPACITY, + recover_mangled_tool_name, remove_subagent_session_meta, remove_untrusted_mcp_app_meta, + ActionRequiredStream, Extension, ExtensionLoadResult, ExtensionMutation, ExtensionSlot, + GooseMcpAppToolAttachment, TOOL_CALL_NOTIFICATION_CHANNEL_CAPACITY, }; use crate::action_required_manager::ActionRequiredManager; use crate::agents::container::Container; @@ -712,6 +712,7 @@ impl ExtensionLease { remove_untrusted_mcp_app_meta(&mut result); if !is_platform_extension { ExtensionMutation::take(&mut result); + remove_subagent_session_meta(&mut result); } if let Some(mcp_app_call) = mcp_app_call { mcp_app_call diff --git a/crates/goose/src/agents/extension_manager/mod.rs b/crates/goose/src/agents/extension_manager/mod.rs index 59db29572..1468b3c1d 100644 --- a/crates/goose/src/agents/extension_manager/mod.rs +++ b/crates/goose/src/agents/extension_manager/mod.rs @@ -522,6 +522,18 @@ fn remove_untrusted_mcp_app_meta(result: &mut CallToolResult) { } } +fn remove_subagent_session_meta(result: &mut CallToolResult) { + let Some(meta) = result.meta.as_mut() else { + return; + }; + + meta.0.remove("subagent_session_id"); + + if meta.0.is_empty() { + result.meta = None; + } +} + fn insert_trusted_tool_update_meta( result: &mut CallToolResult, attachment: &GooseMcpAppToolAttachment, @@ -1531,6 +1543,89 @@ mod tests { } } + struct SubagentMetaClient; + + #[async_trait::async_trait] + impl McpClientTrait for SubagentMetaClient { + async fn list_tools( + &self, + _session_id: &str, + _next_cursor: Option, + _cancellation_token: CancellationToken, + ) -> Result { + Ok(ListToolsResult { + tools: vec![Tool::new( + "delegate".to_string(), + "test tool".to_string(), + Arc::new(serde_json::Map::new()), + )], + ..Default::default() + }) + } + + async fn call_tool( + &self, + _ctx: &ToolCallContext, + _name: &str, + _arguments: Option, + _cancellation_token: CancellationToken, + ) -> Result { + let meta = serde_json::json!({ + "subagent_session_id": "other-session", + "unrelated": "kept", + }); + Ok(CallToolResult::success(vec![]) + .with_meta(Some(MetaObject(meta.as_object().unwrap().clone())))) + } + + fn get_info(&self) -> Option<&InitializeResult> { + None + } + } + + async fn dispatch_subagent_meta_tool(extension: &str, tool: &str) -> Option { + let temp_dir = tempfile::tempdir().unwrap(); + let extension_manager = Arc::new(ExtensionManager::with_data_dir( + temp_dir.path().to_path_buf(), + )); + extension_manager + .add_mock_extension(extension.to_string(), Arc::new(SubagentMetaClient)) + .await; + + let dispatched = extension_manager + .scope_lease("session") + .await + .call( + CallToolRequestParams::new(tool.to_string()).with_arguments(object!({})), + CallRequest::from(&ToolCallContext::new("session".to_string(), None, None)), + CancellationToken::default(), + ) + .await + .expect("tool call should dispatch"); + + dispatched.result.await.unwrap().meta + } + + #[tokio::test] + async fn dispatch_strips_subagent_session_id_from_external_extensions() { + let meta = dispatch_subagent_meta_tool("external", "external__delegate").await; + + assert_eq!( + meta.map(|meta| serde_json::Value::Object(meta.0)), + Some(serde_json::json!({"unrelated": "kept"})), + ); + } + + #[tokio::test] + async fn dispatch_keeps_subagent_session_id_from_platform_extensions() { + let meta = dispatch_subagent_meta_tool("summon", "delegate").await; + + assert_eq!( + meta.and_then(|meta| meta.0.get("subagent_session_id").cloned()), + Some(serde_json::json!("other-session")), + ); + } + fn app_tool(name: &str) -> Tool { let mut tool = Tool::new( name.to_string(), diff --git a/crates/goose/tests/acp_server_test.rs b/crates/goose/tests/acp_server_test.rs index 37304fa62..8341917de 100644 --- a/crates/goose/tests/acp_server_test.rs +++ b/crates/goose/tests/acp_server_test.rs @@ -836,6 +836,65 @@ fn test_load_session_replays_image_attachment() { run_test(async { run_load_session_replays_image_attachment::().await }); } +async fn seed_session_awaiting_approval(data_root: &Path, session_type: SessionType) -> String { + let session_manager = SessionManager::new(data_root.to_path_buf()); + let session = session_manager + .create_session( + data_root.to_path_buf(), + "Awaiting approval".to_string(), + session_type, + GooseMode::default(), + ) + .await + .unwrap(); + for message in [ + Message::user().with_text("run the tool"), + Message::assistant().with_action_required( + "approval", + "tool".to_string(), + Default::default(), + None, + ), + ] { + session_manager + .add_message(&session.id, &message) + .await + .unwrap(); + } + session.id +} + +fn starts_a_run(updates: &[SessionUpdate]) -> bool { + updates.iter().any(|update| match update { + SessionUpdate::SessionInfoUpdate(info) => info + .meta + .as_ref() + .and_then(|meta| meta.get("goose")) + .and_then(|goose| goose.get("activeRunId")) + .is_some_and(serde_json::Value::is_string), + _ => false, + }) +} + +#[test] +fn test_load_session_resumes_pending_approval_except_for_subagents() { + run_test(async { + for (session_type, resumes) in [(SessionType::Acp, true), (SessionType::SubAgent, false)] { + let data_root = tempfile::tempdir().unwrap(); + let session_id = seed_session_awaiting_approval(data_root.path(), session_type).await; + let mut conn = new_connection(data_root.path()).await; + + let SessionData { session, .. } = conn.load_session(&session_id, vec![]).await.unwrap(); + + assert_eq!( + starts_a_run(&session.session_updates()), + resumes, + "{session_type:?}" + ); + } + }); +} + #[test] fn test_mode_set() { run_test(async { run_mode_set::().await }); diff --git a/ui/desktop/src/acp/__tests__/sessionNotificationAdapter.test.ts b/ui/desktop/src/acp/__tests__/sessionNotificationAdapter.test.ts index f11d618ea..1ca09a1e6 100644 --- a/ui/desktop/src/acp/__tests__/sessionNotificationAdapter.test.ts +++ b/ui/desktop/src/acp/__tests__/sessionNotificationAdapter.test.ts @@ -411,7 +411,25 @@ describe('createAcpSessionNotificationAdapter', () => { }); describe('tools', () => { - it('maps tool calls and successful responses, including MCP app metadata', () => { + it('preserves the subagent session ID without MCP app metadata', () => { + const adapter = createAcpSessionNotificationAdapter(); + const messages = expectOnlyMessagesChange( + adapter.apply( + acpUpdate({ + ...DEFAULT_TOOL_CALL_UPDATE, + status: 'completed', + _meta: { goose: { subagentSessionId: 'child-session' } }, + }) + ) + ); + + expect(getToolResponses(messages[0])[0].toolResult).toMatchObject({ + status: 'success', + value: { _meta: { subagent_session_id: 'child-session' } }, + }); + }); + + it('maps tool calls and successful responses, preserving app and subagent metadata', () => { const adapter = createAcpSessionNotificationAdapter(); const toolCallStateChanges = adapter.apply( @@ -470,6 +488,7 @@ describe('createAcpSessionNotificationAdapter', () => { ], _meta: { goose: { + subagentSessionId: 'child-session', mcpApp: { resourceUri: 'ui://app/resource', extensionName: 'developer', @@ -493,6 +512,7 @@ describe('createAcpSessionNotificationAdapter', () => { content: [{ type: 'text', text: 'rendered result' }], isError: false, _meta: { + subagent_session_id: 'child-session', ui: { resourceUri: 'ui://app/resource' }, extensionName: 'developer', toolName: 'read_file', diff --git a/ui/desktop/src/acp/adapter/tools.ts b/ui/desktop/src/acp/adapter/tools.ts index ce7f16379..87d1534e9 100644 --- a/ui/desktop/src/acp/adapter/tools.ts +++ b/ui/desktop/src/acp/adapter/tools.ts @@ -84,7 +84,7 @@ export function applyToolCallUpdate( status: 'success', value: toolResultValue( toolCallState, - mcpAppMetadata(update), + toolResultMetadata(update), toolCallState.status === 'failed' ), }, @@ -211,7 +211,7 @@ function baseToolMetadata( function toolResultValue( update: ToolCallUpdate, - mcpAppMeta: DesktopMcpAppMeta | undefined, + meta: DesktopToolResultMeta | undefined, isError: boolean ): ToolResultValue { const content = toolResultContent(update); @@ -226,7 +226,7 @@ function toolResultValue( const toolResult: ToolResultValue = { content, isError, - ...(mcpAppMeta ? { _meta: mcpAppMeta } : {}), + ...(meta ? { _meta: meta } : {}), }; if (update.rawOutput !== undefined) { @@ -326,47 +326,48 @@ function apiResourceContentsFromAcpResource( }; } -interface DesktopMcpAppMeta extends Record { - ui: { +interface DesktopToolResultMeta extends Record { + ui?: { resourceUri: string; }; extensionName?: string; toolName?: string; toolNameIsActual?: boolean; + subagent_session_id?: string; } type ToolResultValue = { content: GooseContentBlock[]; structuredContent?: unknown; isError: boolean; - _meta?: DesktopMcpAppMeta; + _meta?: DesktopToolResultMeta; }; -function mcpAppMetadata(update: ToolCallUpdate): DesktopMcpAppMeta | undefined { +function toolResultMetadata(update: ToolCallUpdate): DesktopToolResultMeta | undefined { if (!isRecord(update._meta)) { return undefined; } const goose = update._meta.goose; - if (!isRecord(goose) || !isRecord(goose.mcpApp)) { + if (!isRecord(goose)) { return undefined; } - const resourceUri = goose.mcpApp.resourceUri; - if (typeof resourceUri !== 'string') { - return undefined; + const meta: DesktopToolResultMeta = {}; + if (typeof goose.subagentSessionId === 'string') { + meta.subagent_session_id = goose.subagentSessionId; } - return { - ui: { - resourceUri, - }, - extensionName: - typeof goose.mcpApp.extensionName === 'string' ? goose.mcpApp.extensionName : undefined, - toolName: typeof goose.mcpApp.toolName === 'string' ? goose.mcpApp.toolName : undefined, - toolNameIsActual: + if (isRecord(goose.mcpApp) && typeof goose.mcpApp.resourceUri === 'string') { + meta.ui = { resourceUri: goose.mcpApp.resourceUri }; + meta.extensionName = + typeof goose.mcpApp.extensionName === 'string' ? goose.mcpApp.extensionName : undefined; + meta.toolName = typeof goose.mcpApp.toolName === 'string' ? goose.mcpApp.toolName : undefined; + meta.toolNameIsActual = typeof goose.mcpApp.toolNameIsActual === 'boolean' ? goose.mcpApp.toolNameIsActual - : undefined, - }; + : undefined; + } + + return Object.keys(meta).length > 0 ? meta : undefined; } diff --git a/ui/desktop/src/components/BaseChat.tsx b/ui/desktop/src/components/BaseChat.tsx index 5b79a2826..52819243c 100644 --- a/ui/desktop/src/components/BaseChat.tsx +++ b/ui/desktop/src/components/BaseChat.tsx @@ -8,6 +8,7 @@ import MessageList from './MessageList'; import { MainPanelLayout } from './Layout/MainPanelLayout'; import ChatInput from './ChatInput'; import { ChatInputCard } from './ChatInputCard'; +import { SubagentSessionNotice } from './SubagentSessionNotice'; import { Button } from './ui/button'; import { ScrollArea, ScrollAreaHandle } from './ui/scroll-area'; import { useFileDrop } from '../hooks/useFileDrop'; @@ -152,6 +153,7 @@ export default function BaseChat({ submitElicitationResponse, stopStreaming, retrySessionLoad, + refreshSession, sessionLoadError, tokenState, notifications: toolCallNotifications, @@ -169,6 +171,7 @@ export default function BaseChat({ ); const sessionLoaded = session !== undefined; + const isSubagentSession = session?.session_type === 'sub_agent'; const liveVoiceChatBusy = chatState !== ChatState.Idle; useEffect(() => { @@ -492,7 +495,7 @@ export default function BaseChat({ )} - {recipe && ( + {recipe && !isSubagentSession && (
@@ -537,7 +540,7 @@ export default function BaseChat({ )} - {quoteButtonPos && ( + {quoteButtonPos && !isSubagentSession && ( + + ); +} diff --git a/ui/desktop/src/components/UserMessage.test.tsx b/ui/desktop/src/components/UserMessage.test.tsx new file mode 100644 index 000000000..63389cc13 --- /dev/null +++ b/ui/desktop/src/components/UserMessage.test.tsx @@ -0,0 +1,29 @@ +import { render, screen } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; +import { IntlTestWrapper } from '../i18n/test-utils'; +import type { Message } from '../types/message'; +import UserMessage from './UserMessage'; + +const message: Message = { + content: [{ type: 'text', text: 'Find all callers of load_session' }], + created: Date.now(), + id: 'msg-1', + metadata: { agentVisible: true, userVisible: true }, + role: 'user', +}; + +describe('UserMessage', () => { + it('offers editing when the message can be updated', () => { + render(, { + wrapper: IntlTestWrapper, + }); + + expect(screen.getByRole('button', { name: /Edit message/ })).toBeInTheDocument(); + }); + + it('hides editing when the message cannot be updated', () => { + render(, { wrapper: IntlTestWrapper }); + + expect(screen.queryByRole('button', { name: /Edit message/ })).not.toBeInTheDocument(); + }); +}); diff --git a/ui/desktop/src/components/UserMessage.tsx b/ui/desktop/src/components/UserMessage.tsx index 15070f298..1aab2d706 100644 --- a/ui/desktop/src/components/UserMessage.tsx +++ b/ui/desktop/src/components/UserMessage.tsx @@ -353,24 +353,26 @@ function UserMessage({ message, onMessageUpdate }: UserMessageProps) { {timestamp}
- + {onMessageUpdate && ( + + )}
diff --git a/ui/desktop/src/components/rtlChatDirection.test.tsx b/ui/desktop/src/components/rtlChatDirection.test.tsx index 207c6b965..0e9bcf978 100644 --- a/ui/desktop/src/components/rtlChatDirection.test.tsx +++ b/ui/desktop/src/components/rtlChatDirection.test.tsx @@ -153,7 +153,7 @@ describe('RTL chat direction', () => { }); it('updates the edit textarea direction as the content changes', () => { - renderWithIntl(); + renderWithIntl(); fireEvent.click(screen.getByRole('button', { name: /Edit message/ })); const textarea = screen.getByRole('textbox') as HTMLTextAreaElement; diff --git a/ui/desktop/src/hooks/useChatSession.ts b/ui/desktop/src/hooks/useChatSession.ts index 30dc9ab9d..e75b1d30f 100644 --- a/ui/desktop/src/hooks/useChatSession.ts +++ b/ui/desktop/src/hooks/useChatSession.ts @@ -152,6 +152,11 @@ export function useChatSession({ [sessionId, onSessionLoaded] ); + const refreshSession = useCallback( + () => acpChatSessionController.restoreSession(sessionId), + [sessionId] + ); + // Load session on mount or sessionId change useEffect(() => { void retrySessionLoad(); @@ -351,6 +356,7 @@ export function useChatSession({ submitElicitationResponse, stopStreaming, retrySessionLoad, + refreshSession, tokenState, notifications: notificationsMap, pauseQueueOnStop: false, diff --git a/ui/desktop/src/hooks/useChatSessionTypes.ts b/ui/desktop/src/hooks/useChatSessionTypes.ts index 5f3b1f562..6534ae7fc 100644 --- a/ui/desktop/src/hooks/useChatSessionTypes.ts +++ b/ui/desktop/src/hooks/useChatSessionTypes.ts @@ -23,6 +23,7 @@ export interface UseChatSessionResult { ) => Promise; stopStreaming: () => void; retrySessionLoad: () => Promise; + refreshSession: () => Promise; sessionLoadError?: string; tokenState: TokenState; notifications: Map; diff --git a/ui/desktop/src/i18n/messages/de.json b/ui/desktop/src/i18n/messages/de.json index 228ddcbf8..2f8657aba 100644 --- a/ui/desktop/src/i18n/messages/de.json +++ b/ui/desktop/src/i18n/messages/de.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Konfigurieren Sie ein Subrezept, das während der Rezeptausführung als Tool aufgerufen werden kann" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Neuesten Fortschritt laden" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Der Fortschritt des Subagenten wird hier nicht live angezeigt." + }, "switchModelModal.backToModelList": { "defaultMessage": "Zurück zur Modellliste" }, diff --git a/ui/desktop/src/i18n/messages/en.json b/ui/desktop/src/i18n/messages/en.json index 01b41b9c4..99a057a41 100644 --- a/ui/desktop/src/i18n/messages/en.json +++ b/ui/desktop/src/i18n/messages/en.json @@ -4394,6 +4394,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Configure a subrecipe that can be called as a tool during recipe execution" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Load latest progress" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Subagent progress isn't shown live here." + }, "switchModelModal.backToModelList": { "defaultMessage": "Back to model list" }, diff --git a/ui/desktop/src/i18n/messages/es.json b/ui/desktop/src/i18n/messages/es.json index 26c951977..47a76278f 100644 --- a/ui/desktop/src/i18n/messages/es.json +++ b/ui/desktop/src/i18n/messages/es.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Configura una subreceta que se pueda invocar como herramienta durante la ejecución de la receta" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Cargar el progreso más reciente" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "El progreso del subagente no se muestra en directo aquí." + }, "switchModelModal.backToModelList": { "defaultMessage": "Volver a la lista de modelos" }, diff --git a/ui/desktop/src/i18n/messages/fr.json b/ui/desktop/src/i18n/messages/fr.json index 98c0dd08c..bf0fc1ebe 100644 --- a/ui/desktop/src/i18n/messages/fr.json +++ b/ui/desktop/src/i18n/messages/fr.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Configurez une sous-recette qui peut être appelée en tant qu'outil lors de l'exécution de la recette" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Charger la progression la plus récente" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "La progression du sous-agent n'est pas affichée en direct ici." + }, "switchModelModal.backToModelList": { "defaultMessage": "Retour à la liste des modèles" }, diff --git a/ui/desktop/src/i18n/messages/hi.json b/ui/desktop/src/i18n/messages/hi.json index b0dc52673..236563d33 100644 --- a/ui/desktop/src/i18n/messages/hi.json +++ b/ui/desktop/src/i18n/messages/hi.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "ऐसी सबरेसिपी कॉन्फ़िगर करें जिसे रेसिपी निष्पादन के दौरान टूल की तरह कॉल किया जा सके" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "नवीनतम प्रगति लोड करें" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "सबएजेंट की प्रगति यहाँ लाइव नहीं दिखाई जाती।" + }, "switchModelModal.backToModelList": { "defaultMessage": "मॉडल सूची पर वापस जाएँ" }, diff --git a/ui/desktop/src/i18n/messages/id.json b/ui/desktop/src/i18n/messages/id.json index dfec16102..bfe99779a 100644 --- a/ui/desktop/src/i18n/messages/id.json +++ b/ui/desktop/src/i18n/messages/id.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Konfigurasikan subresep yang dapat dipanggil sebagai alat selama eksekusi resep" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Muat progres terbaru" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Progres subagen tidak ditampilkan secara langsung di sini." + }, "switchModelModal.backToModelList": { "defaultMessage": "Kembali ke daftar model" }, diff --git a/ui/desktop/src/i18n/messages/it.json b/ui/desktop/src/i18n/messages/it.json index 59e09174a..c46d9d995 100644 --- a/ui/desktop/src/i18n/messages/it.json +++ b/ui/desktop/src/i18n/messages/it.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Configura una sottoricetta che può essere richiamata come strumento durante l'esecuzione della ricetta" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Carica gli ultimi progressi" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "I progressi del subagente non vengono mostrati in tempo reale qui." + }, "switchModelModal.backToModelList": { "defaultMessage": "Torna all'elenco dei modelli" }, diff --git a/ui/desktop/src/i18n/messages/ja.json b/ui/desktop/src/i18n/messages/ja.json index 13786576c..d6cb27c09 100644 --- a/ui/desktop/src/i18n/messages/ja.json +++ b/ui/desktop/src/i18n/messages/ja.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "レシピ実行中にツールとして呼び出せるサブレシピを設定します" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "最新の進捗を読み込む" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "サブエージェントの進捗はここではリアルタイムに表示されません。" + }, "switchModelModal.backToModelList": { "defaultMessage": "モデル一覧に戻る" }, diff --git a/ui/desktop/src/i18n/messages/ko.json b/ui/desktop/src/i18n/messages/ko.json index 3f55888db..8412aa558 100644 --- a/ui/desktop/src/i18n/messages/ko.json +++ b/ui/desktop/src/i18n/messages/ko.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "레시피 실행 시 도구로 호출할 수 있는 서브레시피를 구성합니다." }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "최신 진행 상황 불러오기" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "하위 에이전트 진행 상황은 여기에 실시간으로 표시되지 않습니다." + }, "switchModelModal.backToModelList": { "defaultMessage": "모델 목록으로 돌아가기" }, diff --git a/ui/desktop/src/i18n/messages/ms.json b/ui/desktop/src/i18n/messages/ms.json index 4f68b3d7c..e7d49e00f 100644 --- a/ui/desktop/src/i18n/messages/ms.json +++ b/ui/desktop/src/i18n/messages/ms.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Konfigurasikan subresipi yang boleh dipanggil sebagai alat semasa pelaksanaan resipi" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Muatkan kemajuan terkini" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Kemajuan subagen tidak dipaparkan secara langsung di sini." + }, "switchModelModal.backToModelList": { "defaultMessage": "Kembali ke senarai model" }, diff --git a/ui/desktop/src/i18n/messages/pt.json b/ui/desktop/src/i18n/messages/pt.json index 1d2427127..00c600f06 100644 --- a/ui/desktop/src/i18n/messages/pt.json +++ b/ui/desktop/src/i18n/messages/pt.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Configure uma subrreceita que pode ser invocada como ferramenta durante a execução da receita" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Carregar o progresso mais recente" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "O progresso do subagente não é mostrado ao vivo aqui." + }, "switchModelModal.backToModelList": { "defaultMessage": "Voltar à lista de modelos" }, diff --git a/ui/desktop/src/i18n/messages/ru.json b/ui/desktop/src/i18n/messages/ru.json index 812292d3c..03801c324 100644 --- a/ui/desktop/src/i18n/messages/ru.json +++ b/ui/desktop/src/i18n/messages/ru.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Настройте подрецепт, который можно вызывать как инструмент при выполнении рецепта" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Загрузить последний прогресс" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Прогресс субагента здесь не отображается в реальном времени." + }, "switchModelModal.backToModelList": { "defaultMessage": "Назад к списку моделей" }, diff --git a/ui/desktop/src/i18n/messages/tr.json b/ui/desktop/src/i18n/messages/tr.json index 699055cb7..b54280fd4 100644 --- a/ui/desktop/src/i18n/messages/tr.json +++ b/ui/desktop/src/i18n/messages/tr.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Tarif yürütme sırasında araç olarak çağrılabilecek bir alt tarif yapılandırın" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "En son ilerlemeyi yükle" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Alt ajan ilerlemesi burada canlı olarak gösterilmez." + }, "switchModelModal.backToModelList": { "defaultMessage": "Model listesine geri dön" }, diff --git a/ui/desktop/src/i18n/messages/vi.json b/ui/desktop/src/i18n/messages/vi.json index 64981820d..0ed0de615 100644 --- a/ui/desktop/src/i18n/messages/vi.json +++ b/ui/desktop/src/i18n/messages/vi.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "Định cấu hình một công thức con có thể được gọi như công cụ trong quá trình thực thi công thức" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "Tải tiến trình mới nhất" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "Tiến trình của tác tử con không được hiển thị trực tiếp tại đây." + }, "switchModelModal.backToModelList": { "defaultMessage": "Quay lại danh sách mô hình" }, diff --git a/ui/desktop/src/i18n/messages/zh-CN.json b/ui/desktop/src/i18n/messages/zh-CN.json index f91f4ccf6..1502e6c6a 100644 --- a/ui/desktop/src/i18n/messages/zh-CN.json +++ b/ui/desktop/src/i18n/messages/zh-CN.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "配置一个可在配方执行过程中作为工具调用的子配方" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "加载最新进度" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "子代理的进度不会在此实时显示。" + }, "switchModelModal.backToModelList": { "defaultMessage": "返回模型列表" }, diff --git a/ui/desktop/src/i18n/messages/zh-TW.json b/ui/desktop/src/i18n/messages/zh-TW.json index cb887d41b..161ab6c60 100644 --- a/ui/desktop/src/i18n/messages/zh-TW.json +++ b/ui/desktop/src/i18n/messages/zh-TW.json @@ -4277,6 +4277,12 @@ "subRecipeModal.subtitle": { "defaultMessage": "設定可在配方執行期間作為工具呼叫的子配方" }, + "subagentSessionNotice.loadLatestProgress": { + "defaultMessage": "載入最新進度" + }, + "subagentSessionNotice.notice": { + "defaultMessage": "子代理的進度不會在此即時顯示。" + }, "switchModelModal.backToModelList": { "defaultMessage": "返回模型清單" },