import 'package:cutdex_agent/cutdex_agent.dart'; import 'package:cutdex_sdk/editor.dart'; import 'package:cutdex_sdk/mcp.dart'; import 'package:cutdex_sdk/tools.dart'; import 'agent/editor_agent_tools.dart'; import 'tool_workspace_registry.dart'; /// Immutable composition result exposing protocol projections of one registry. class EditorToolAccess { EditorToolAccess(EditorSession session) : this._(EditorToolRegistry(session)); EditorToolAccess.application(EditorCommandHost host) : this._(EditorToolRegistry.application(host)); EditorToolAccess._(this.registry); final EditorToolRegistry registry; Object get owner => registry.owner; Map get workspaces => registry.workspaces; void attach(EditorSession? session, {String? projectId}) => registry.attach(session, projectId: projectId); Future dispose() => registry.dispose(); late final List agentTools = editorAgentTools( registry.workspaces, dynamicWorkspaces: registry.dynamicWorkspaces, ); late final server = CutdexMcpServer( resolveWorkspaces: registry.dynamicWorkspaces ? () => [ for (final entry in registry.workspaces.entries) McpWorkspace(id: entry.key, title: entry.key, tools: entry.value), ] : null, workspaces: [ for (final entry in registry.workspaces.entries) McpWorkspace(id: entry.key, title: entry.key, tools: entry.value), ], ); }