Files
cutdex/lib/integrations/editor_tool_access.dart
lingjhf 38ca180cf7
Gitea CI / Check code and tests (pull_request) Failing after 8s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped
Gitea CI / Gitea CI passed (pull_request) Failing after 1s
refactor(core): own editor UI and pin verified native releases
2026-10-12 03:20:29 +08:00

46 lines
1.4 KiB
Dart

import 'package:cutdex_agent/cutdex_agent.dart';
import 'package:cutdex_core/editor.dart';
import 'package:cutdex_core/mcp.dart';
import 'package:cutdex_core/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<String, EditorToolDispatcher> get workspaces => registry.workspaces;
void attach(EditorSession? session, {String? projectId}) =>
registry.attach(session, projectId: projectId);
Future<void> dispose() => registry.dispose();
late final List<AgentTool> 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),
],
);
}