ai-editor-client-dev 1.0.244__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,183 @@
1
+ """
2
+ Public async client for ai-editor-server (JSON-RPC via mcp-proxy-adapter).
3
+
4
+ ``UniversalFileClient`` (via :attr:`~ai_editor_client.client.CodeAnalysisAsyncClient.universal_files`)
5
+ is the single supported file-workflow facade for the thin MCP Workflow Surface (C-016).
6
+ ``FileSessionClient``, ``EditorFileClient``, ``EditorFileHandle``, and ``LocalEditWorkspace``
7
+ are deprecated parallel facades (C-020) and emit :class:`DeprecationWarning` on instantiation.
8
+
9
+ Author: Vasiliy Zdanovskiy
10
+ email: vasilyvz@gmail.com
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import warnings
16
+ from pathlib import Path
17
+ from typing import Optional
18
+
19
+ from ai_editor_client.client import CodeAnalysisAsyncClient
20
+ from ai_editor_client.commands_proxy import ValidatedCommandsProxy
21
+ from ai_editor_client.config import (
22
+ adapter_settings_from_server_config,
23
+ adapter_settings_to_jsonrpc_kwargs,
24
+ load_server_config,
25
+ )
26
+ from ai_editor_client.editor_file import (
27
+ EditorFileClient as _EditorFileClient,
28
+ EditorFileHandle as _EditorFileHandle,
29
+ )
30
+ from ai_editor_client.exceptions import ClientValidationError, ServerVersionMismatch
31
+ from ai_editor_client.file_session import (
32
+ FileSessionClient as _FileSessionClient,
33
+ SessionNotFoundError,
34
+ )
35
+ from ai_editor_client.local_edit_workspace import (
36
+ EditorFileWorkflowError,
37
+ LocalEditWorkspace as _LocalEditWorkspace,
38
+ )
39
+ from ai_editor_client.server_api import (
40
+ CLIENT_FACADE_COMMANDS,
41
+ CST_REMOVED_COMMANDS,
42
+ FILE_SESSION_COMMANDS,
43
+ FILE_SESSION_FACADE_METHODS,
44
+ LEGACY_REMOVED_COMMANDS,
45
+ REMOVED_COMMANDS,
46
+ TRANSFER_FACADE_METHODS,
47
+ UNIVERSAL_FILE_COMMANDS,
48
+ )
49
+ from ai_editor_client.universal_file import UniversalFileClient
50
+ from ai_editor_client.server_version import (
51
+ DECLARED_VERSION,
52
+ REQUIRED_SERVER_VERSION,
53
+ VERSION_EXEMPT_COMMANDS,
54
+ )
55
+ from ai_editor_client.server_schema import (
56
+ fetch_command_schema_from_server,
57
+ parse_schema_from_help_payload,
58
+ )
59
+ from ai_editor_client.validation import (
60
+ prepare_params_for_schema,
61
+ validate_params_against_schema,
62
+ )
63
+
64
+ _DEPRECATED_EXPORTS: frozenset[str] = frozenset(
65
+ {
66
+ "FileSessionClient",
67
+ "EditorFileClient",
68
+ "EditorFileHandle",
69
+ "LocalEditWorkspace",
70
+ }
71
+ )
72
+
73
+
74
+ def _emit_deprecated_export_warning(class_name: str) -> None:
75
+ warnings.warn(
76
+ (
77
+ f"{class_name} export is deprecated; use UniversalFileClient via "
78
+ "CodeAnalysisAsyncClient.universal_files (C-016). Removal under C-020."
79
+ ),
80
+ DeprecationWarning,
81
+ stacklevel=3,
82
+ )
83
+
84
+
85
+ class _DeprecatedFileSessionClient(_FileSessionClient):
86
+ def __init__(self, client: CodeAnalysisAsyncClient) -> None:
87
+ _emit_deprecated_export_warning("FileSessionClient")
88
+ super().__init__(client)
89
+
90
+
91
+ class _DeprecatedEditorFileClient(_EditorFileClient):
92
+ def __init__(self, file_sessions: FileSessionClient) -> None:
93
+ _emit_deprecated_export_warning("EditorFileClient")
94
+ super().__init__(file_sessions)
95
+
96
+
97
+ class _DeprecatedEditorFileHandle(_EditorFileHandle):
98
+ def __init__(
99
+ self,
100
+ ca_session_id: str,
101
+ project_id: str,
102
+ file_id: str,
103
+ file_path: str,
104
+ baseline_path: Path,
105
+ workspace: Optional[_LocalEditWorkspace] = None,
106
+ is_closed: bool = False,
107
+ ) -> None:
108
+ _emit_deprecated_export_warning("EditorFileHandle")
109
+ super().__init__(
110
+ ca_session_id=ca_session_id,
111
+ project_id=project_id,
112
+ file_id=file_id,
113
+ file_path=file_path,
114
+ baseline_path=baseline_path,
115
+ workspace=workspace,
116
+ is_closed=is_closed,
117
+ )
118
+
119
+
120
+ class _DeprecatedLocalEditWorkspace(_LocalEditWorkspace):
121
+ def __init__(
122
+ self,
123
+ workspace_id: str,
124
+ baseline_path: Path,
125
+ session_dir: Path,
126
+ working_path: Path,
127
+ is_open: bool = True,
128
+ ) -> None:
129
+ _emit_deprecated_export_warning("LocalEditWorkspace")
130
+ super().__init__(
131
+ workspace_id=workspace_id,
132
+ baseline_path=baseline_path,
133
+ session_dir=session_dir,
134
+ working_path=working_path,
135
+ is_open=is_open,
136
+ )
137
+
138
+
139
+ FileSessionClient = _DeprecatedFileSessionClient
140
+ EditorFileClient = _DeprecatedEditorFileClient
141
+ EditorFileHandle = _DeprecatedEditorFileHandle
142
+ LocalEditWorkspace = _DeprecatedLocalEditWorkspace
143
+
144
+ __all__ = [
145
+ "CLIENT_FACADE_COMMANDS",
146
+ "CST_REMOVED_COMMANDS",
147
+ "DECLARED_VERSION",
148
+ "REQUIRED_SERVER_VERSION",
149
+ "VERSION_EXEMPT_COMMANDS",
150
+ "ClientValidationError",
151
+ "CodeAnalysisAsyncClient",
152
+ "EditorFileClient",
153
+ "EditorFileHandle",
154
+ "EditorFileWorkflowError",
155
+ "FILE_SESSION_COMMANDS",
156
+ "FILE_SESSION_FACADE_METHODS",
157
+ "FileSessionClient",
158
+ "LEGACY_REMOVED_COMMANDS",
159
+ "LocalEditWorkspace",
160
+ "REMOVED_COMMANDS",
161
+ "ServerVersionMismatch",
162
+ "SessionNotFoundError",
163
+ "TRANSFER_FACADE_METHODS",
164
+ "UNIVERSAL_FILE_COMMANDS",
165
+ "UniversalFileClient",
166
+ "ValidatedCommandsProxy",
167
+ "adapter_settings_from_server_config",
168
+ "adapter_settings_to_jsonrpc_kwargs",
169
+ "fetch_command_schema_from_server",
170
+ "load_server_config",
171
+ "parse_schema_from_help_payload",
172
+ "prepare_params_for_schema",
173
+ "validate_params_against_schema",
174
+ ]
175
+
176
+
177
+ # One declaration, one number. `ai_editor_client.server_version` reads
178
+ # `version.txt` (a symlink to the repository-root VERSION file, resolved to real
179
+ # content in the built wheel) and is the module the per-call server-version
180
+ # guard enforces against. `__version__` is that same value, never a second
181
+ # derivation of it -- the previous local reader here had a "0.0.0" fallback,
182
+ # which is exactly the kind of guessed number a guard must never be handed.
183
+ __version__ = DECLARED_VERSION