Skip to content

Commit 122ef50

Browse files
committed
remove obsolete type aliases
Signed-off-by: Richard Chien <stdrc@outlook.com>
1 parent a21bb46 commit 122ef50

File tree

2 files changed

+1
-53
lines changed

2 files changed

+1
-53
lines changed

scripts/gen_schema.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
VERSION_FILE = SCHEMA_DIR / "VERSION"
1818
SCHEMA_OUT = ROOT / "src" / "acp" / "schema.py"
1919

20-
BACKCOMPAT_MARKER = "# Backwards compatibility aliases"
21-
2220
# Pattern caches used when post-processing generated schema.
2321
FIELD_DECLARATION_PATTERN = re.compile(r"[A-Za-z_][A-Za-z0-9_]*\s*:")
2422
DESCRIPTION_PATTERN = re.compile(
@@ -69,10 +67,6 @@
6967
"ToolCallContent3": "TerminalToolCallContent",
7068
}
7169

72-
ALIASES_MAP = {
73-
"StdioMcpServer": "McpServerStdio",
74-
}
75-
7670
ENUM_LITERAL_MAP: dict[str, tuple[str, ...]] = {
7771
"PermissionOptionKind": (
7872
"allow_once",
@@ -174,7 +168,6 @@ def postprocess_generated_schema(output_path: Path) -> list[str]:
174168
header_block = _build_header_block()
175169

176170
content = _strip_existing_header(raw_content)
177-
content = _remove_backcompat_block(content)
178171
content = _remove_unused_models(content)
179172
content, leftover_classes = _rename_numbered_models(content)
180173

@@ -191,8 +184,7 @@ def postprocess_generated_schema(output_path: Path) -> list[str]:
191184
missing_targets = _find_missing_targets(content)
192185

193186
content = _inject_enum_aliases(content)
194-
alias_block = _build_alias_block()
195-
final_content = header_block + content.rstrip() + "\n\n" + alias_block
187+
final_content = header_block + content.rstrip() + "\n"
196188
if not final_content.endswith("\n"):
197189
final_content += "\n"
198190
output_path.write_text(final_content, encoding="utf-8")
@@ -224,26 +216,13 @@ def _build_header_block() -> str:
224216
return "\n".join(header_lines) + "\n\n"
225217

226218

227-
def _build_alias_block() -> str:
228-
alias_lines = [f"{old} = {new}" for old, new in sorted(RENAME_MAP.items())]
229-
alias_lines += [f"{old} = {new}" for old, new in sorted(ALIASES_MAP.items())]
230-
return BACKCOMPAT_MARKER + "\n" + "\n".join(alias_lines) + "\n"
231-
232-
233219
def _strip_existing_header(content: str) -> str:
234220
existing_header = re.match(r"(#.*\n)+", content)
235221
if existing_header:
236222
return content[existing_header.end() :].lstrip("\n")
237223
return content.lstrip("\n")
238224

239225

240-
def _remove_backcompat_block(content: str) -> str:
241-
marker_index = content.find(BACKCOMPAT_MARKER)
242-
if marker_index != -1:
243-
return content[:marker_index].rstrip()
244-
return content
245-
246-
247226
def _rename_numbered_models(content: str) -> tuple[str, list[str]]:
248227
renamed = content
249228
for old, new in sorted(RENAME_MAP.items(), key=lambda item: len(item[0]), reverse=True):

src/acp/schema.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,34 +2765,3 @@ class SessionNotification(BaseModel):
27652765
class AgentNotification(BaseModel):
27662766
method: str
27672767
params: Optional[Union[SessionNotification, Any]] = None
2768-
2769-
2770-
# Backwards compatibility aliases
2771-
AgentResponse1 = AgentResponseMessage
2772-
AgentResponse2 = AgentErrorMessage
2773-
ClientResponse1 = ClientResponseMessage
2774-
ClientResponse2 = ClientErrorMessage
2775-
ContentBlock1 = TextContentBlock
2776-
ContentBlock2 = ImageContentBlock
2777-
ContentBlock3 = AudioContentBlock
2778-
ContentBlock4 = ResourceContentBlock
2779-
ContentBlock5 = EmbeddedResourceContentBlock
2780-
McpServer1 = HttpMcpServer
2781-
McpServer2 = SseMcpServer
2782-
RequestPermissionOutcome1 = DeniedOutcome
2783-
RequestPermissionOutcome2 = AllowedOutcome
2784-
SessionConfigOption1 = SessionConfigOptionSelect
2785-
SessionUpdate1 = UserMessageChunk
2786-
SessionUpdate10 = SessionInfoUpdate
2787-
SessionUpdate2 = AgentMessageChunk
2788-
SessionUpdate3 = AgentThoughtChunk
2789-
SessionUpdate4 = ToolCallStart
2790-
SessionUpdate5 = ToolCallProgress
2791-
SessionUpdate6 = AgentPlanUpdate
2792-
SessionUpdate7 = AvailableCommandsUpdate
2793-
SessionUpdate8 = CurrentModeUpdate
2794-
SessionUpdate9 = ConfigOptionUpdate
2795-
ToolCallContent1 = ContentToolCallContent
2796-
ToolCallContent2 = FileEditToolCallContent
2797-
ToolCallContent3 = TerminalToolCallContent
2798-
StdioMcpServer = McpServerStdio

0 commit comments

Comments
 (0)