fix: align merged desktop ACP runtime wiring

This commit is contained in:
Haitao Pan 2026-04-11 12:07:34 +08:00
parent 61348d1985
commit be7331fa3d
3 changed files with 16 additions and 7 deletions

View File

@ -27,6 +27,7 @@ import '../runtime/codex_runtime.dart';
import '../runtime/codex_config_bridge.dart';
import '../runtime/code_agent_node_orchestrator.dart';
import '../runtime/go_gateway_runtime_desktop_client.dart';
import '../runtime/go_acp_stdio_bridge.dart';
import '../runtime/assistant_artifacts.dart';
import '../runtime/desktop_thread_artifact_service.dart';
import '../runtime/external_code_agent_acp_desktop_transport.dart';
@ -136,6 +137,7 @@ class AppController extends ChangeNotifier {
hostUiFeaturePlatformInternal = Platform.isIOS || Platform.isAndroid
? UiFeaturePlatform.mobile
: UiFeaturePlatform.desktop;
final sharedExternalAcpBridge = GoAcpStdioBridge();
final resolvedRuntimeCoordinator =
runtimeCoordinator ??
@ -143,7 +145,9 @@ class AppController extends ChangeNotifier {
gateway: GatewayRuntime(
store: storeInternal,
identityStore: DeviceIdentityStore(storeInternal),
sessionClient: GoGatewayRuntimeDesktopClient(),
sessionClient: GoGatewayRuntimeDesktopClient(
bridge: sharedExternalAcpBridge,
),
allowDirectSocketFallbackOnSessionClientFailure:
shouldBlockEmbeddedAgentLaunch(
isAppleHost: Platform.isIOS || Platform.isMacOS,
@ -214,7 +218,9 @@ class AppController extends ChangeNotifier {
goTaskServiceClient ??
DesktopGoTaskService(
gateway: runtimeCoordinatorInternal.gateway,
acpTransport: ExternalCodeAgentAcpDesktopTransport(),
acpTransport: ExternalCodeAgentAcpDesktopTransport(
bridge: sharedExternalAcpBridge,
),
);
multiAgentOrchestratorInternal = MultiAgentOrchestrator(
config: resolveMultiAgentConfigInternal(
@ -293,6 +299,9 @@ class AppController extends ChangeNotifier {
late final GoTaskServiceClient goTaskServiceClientInternal;
late final MultiAgentOrchestrator multiAgentOrchestratorInternal;
late final MultiAgentMountManager multiAgentMountManagerInternal;
GoTaskServiceClient get goTaskServiceClientForTest => goTaskServiceClientInternal;
Map<SingleAgentProvider, SingleAgentCapabilities>
singleAgentCapabilitiesByProviderInternal =
const <SingleAgentProvider, SingleAgentCapabilities>{};

View File

@ -225,7 +225,7 @@ bool singleAgentProviderRequiresLocalPathRuntimeInternal(
SingleAgentProvider provider,
) {
final configuredEndpoint = controller.settings
.externalAcpEndpointForProvider(provider)
.providerSyncDefinitionForProvider(provider)
.endpoint
.trim();
if (configuredEndpoint.isEmpty) {

View File

@ -102,9 +102,9 @@ void main() {
final store = SecureConfigStore(
enableSecureStorage: false,
databasePathResolver: () async => '${root.path}/settings.sqlite3',
fallbackDirectoryPathResolver: () async => root.path,
defaultSupportDirectoryPathResolver: () async => root.path,
appDataRootPathResolver: () async => root.path,
secretRootPathResolver: () async => root.path,
supportRootPathResolver: () async => root.path,
);
final controller = AppController(
store: store,
@ -128,7 +128,7 @@ void main() {
final endpoint = 'http://${server.address.address}:${server.port}';
final nextSettings = controller.settings.copyWith(
externalAcpEndpoints: <ExternalAcpEndpointProfile>[
providerSyncDefinitions: <ExternalAcpEndpointProfile>[
ExternalAcpEndpointProfile.defaultsForProvider(
SingleAgentProvider.codex,
).copyWith(endpoint: endpoint),