diff --git a/pyproject.toml b/pyproject.toml index fe0686f..5cf1da7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] authors = [{ name = "Aman Rusia", email = "gapypi@arcfu.com" }] name = "wcgw" -version = "1.0.2" +version = "1.0.3" description = "What could go wrong giving full shell access to chatgpt?" readme = "README.md" requires-python = ">=3.10, <3.13" diff --git a/src/wcgw/types_.py b/src/wcgw/types_.py index b05e38b..aa24e77 100644 --- a/src/wcgw/types_.py +++ b/src/wcgw/types_.py @@ -16,6 +16,22 @@ class BashInteraction(BaseModel): send_specials: Optional[Sequence[Specials]] = None send_ascii: Optional[Sequence[int]] = None + def model_post_init(self, __context: object) -> None: + # Ensure only one of the fields is set + if ( + sum( + [ + int(bool(self.send_text)), + int(bool(self.send_specials)), + int(bool(self.send_ascii)), + ] + ) + != 1 + ): + raise ValueError( + "Exactly one of 'send_text', 'send_specials', or 'send_ascii' must be set" + ) + class ReadImage(BaseModel): file_path: str