diff --git a/src/wcgw/client/tools.py b/src/wcgw/client/tools.py index 47f39ea..662fe67 100644 --- a/src/wcgw/client/tools.py +++ b/src/wcgw/client/tools.py @@ -744,6 +744,7 @@ class Mdata(BaseModel): | ResetShell | FileEditFindReplace | FullFileEdit + | str ) @@ -768,6 +769,8 @@ def register_client(server_url: str, client_uuid: str = "") -> None: # Wait to receive data from the server message = websocket.recv() mdata = Mdata.model_validate_json(message) + if isinstance(mdata.data, str): + raise Exception(mdata) try: output, cost = get_tool_output( mdata.data, default_enc, 0.0, lambda x, y: ("", 0), None diff --git a/src/wcgw/relay/serve.py b/src/wcgw/relay/serve.py index 9e8d6f9..cd83208 100644 --- a/src/wcgw/relay/serve.py +++ b/src/wcgw/relay/serve.py @@ -35,6 +35,7 @@ class Mdata(BaseModel): | ResetShell | FileEditFindReplace | FullFileEdit + | str ) user_id: UUID @@ -65,7 +66,10 @@ async def register_websocket(websocket: WebSocket, uuid: UUID) -> None: sem_version_server = semantic_version.Version.coerce(CLIENT_VERSION_MINIMUM) if sem_version_client < sem_version_server: await websocket.send_text( - f"Client version {client_version} is outdated. Please upgrade to {CLIENT_VERSION_MINIMUM} or higher." + Mdata( + user_id=uuid, + data=f"Client version {client_version} is outdated. Please upgrade to {CLIENT_VERSION_MINIMUM} or higher.", + ).model_dump_json() ) await websocket.close( reason="Client version outdated. Please upgrade to the latest version.",