Add ExecutionContext.signature, fix partial command matching with arguments, fix passing args to Falyx._create_context helper

This commit is contained in:
2025-06-05 17:23:27 -04:00
parent ac82076511
commit b24079ea7e
7 changed files with 63 additions and 31 deletions

View File

@@ -70,7 +70,7 @@ class ExecutionContext(BaseModel):
name: str
args: tuple = ()
kwargs: dict = {}
kwargs: dict = Field(default_factory=dict)
action: Any
result: Any | None = None
exception: Exception | None = None
@@ -120,6 +120,17 @@ class ExecutionContext(BaseModel):
def status(self) -> str:
return "OK" if self.success else "ERROR"
@property
def signature(self) -> str:
"""
Returns a string representation of the action signature, including
its name and arguments.
"""
args = ", ".join(map(repr, self.args))
kwargs = ", ".join(f"{key}={value!r}" for key, value in self.kwargs.items())
signature = ", ".join(filter(None, [args, kwargs]))
return f"{self.name} ({signature})"
def as_dict(self) -> dict:
return {
"name": self.name,