Compare commits

..

1 Commits

Author SHA1 Message Date
Greyson LaLonde
4b2d5633c1 chore: add commitizen to pre-commit hooks 2025-07-09 09:35:02 -04:00
14 changed files with 3224 additions and 3255 deletions

View File

@@ -5,3 +5,7 @@ repos:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0
hooks:
- id: commitizen

View File

@@ -47,7 +47,7 @@ Documentation = "https://docs.crewai.com"
Repository = "https://github.com/crewAIInc/crewAI"
[project.optional-dependencies]
tools = ["crewai-tools~=0.51.0"]
tools = ["crewai-tools~=0.49.0"]
embeddings = [
"tiktoken~=0.8.0"
]

View File

@@ -54,7 +54,7 @@ def _track_install_async():
_track_install_async()
__version__ = "0.141.0"
__version__ = "0.140.0"
__all__ = [
"Agent",
"Crew",

View File

@@ -5,4 +5,4 @@ AUTH0_AUDIENCE = "https://crewai.us.auth0.com/api/v2/"
WORKOS_DOMAIN = "login.crewai.com"
WORKOS_CLI_CONNECT_APP_ID = "client_01JYT06R59SP0NXYGD994NFXXX"
WORKOS_ENVIRONMENT_ID = "client_01JNJQWBJ4SPFN3SWJM5T7BDG8"
WORKOS_ENVIRONMENT_ID = "client_01JNJQWB4HG8T5980R5VHP057C"

View File

@@ -30,9 +30,6 @@ def validate_jwt_token(
jwk_client = PyJWKClient(jwks_url)
signing_key = jwk_client.get_signing_key_from_jwt(jwt_token)
_unverified_decoded_token = jwt.decode(
jwt_token, options={"verify_signature": False}
)
decoded_token = jwt.decode(
jwt_token,
signing_key.key,
@@ -52,15 +49,9 @@ def validate_jwt_token(
except jwt.ExpiredSignatureError:
raise Exception("Token has expired.")
except jwt.InvalidAudienceError:
actual_audience = _unverified_decoded_token.get("aud", "[no audience found]")
raise Exception(
f"Invalid token audience. Got: '{actual_audience}'. Expected: '{audience}'"
)
raise Exception(f"Invalid token audience. Expected: '{audience}'")
except jwt.InvalidIssuerError:
actual_issuer = _unverified_decoded_token.get("iss", "[no issuer found]")
raise Exception(
f"Invalid token issuer. Got: '{actual_issuer}'. Expected: '{issuer}'"
)
raise Exception(f"Invalid token issuer. Expected: '{issuer}'")
except jwt.MissingRequiredClaimError as e:
raise Exception(f"Token is missing required claims: {str(e)}")
except jwt.exceptions.PyJWKClientError as e:

View File

@@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "you@example.com" }]
requires-python = ">=3.10,<3.14"
dependencies = [
"crewai[tools]>=0.141.0,<1.0.0"
"crewai[tools]>=0.140.0,<1.0.0"
]
[project.scripts]

View File

@@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "you@example.com" }]
requires-python = ">=3.10,<3.14"
dependencies = [
"crewai[tools]>=0.141.0,<1.0.0",
"crewai[tools]>=0.140.0,<1.0.0",
]
[project.scripts]

View File

@@ -5,7 +5,7 @@ description = "Power up your crews with {{folder_name}}"
readme = "README.md"
requires-python = ">=3.10,<3.14"
dependencies = [
"crewai[tools]>=0.141.0"
"crewai[tools]>=0.140.0"
]
[tool.crewai]

View File

@@ -120,7 +120,6 @@ class EventListener(BaseEventListener):
"completed",
final_string_output,
)
self.formatter.stop_live()
@crewai_event_bus.on(CrewKickoffFailedEvent)
def on_crew_failed(source, event: CrewKickoffFailedEvent):
@@ -263,7 +262,6 @@ class EventListener(BaseEventListener):
self.formatter.update_flow_status(
self.formatter.current_flow_tree, event.flow_name, source.flow_id
)
self.formatter.stop_live()
@crewai_event_bus.on(MethodExecutionStartedEvent)
def on_method_execution_started(source, event: MethodExecutionStartedEvent):

View File

@@ -1753,9 +1753,3 @@ class ConsoleFormatter:
Attempts=f"{retry_count + 1}",
)
self.print_panel(content, "🛡️ Guardrail Failed", "red")
def stop_live(self) -> None:
"""Stop and clear any active Live session to restore normal terminal output."""
if self._live:
self._live.stop()
self._live = None

View File

@@ -27,7 +27,7 @@ class TestValidateToken(unittest.TestCase):
audience="app_id_xxxx",
)
mock_jwt.decode.assert_called_with(
mock_jwt.decode.assert_called_once_with(
"aaaaa.bbbbbb.cccccc",
"mock_signing_key",
algorithms=["RS256"],

View File

@@ -1,54 +0,0 @@
from unittest.mock import patch
from rich.tree import Tree
from crewai.utilities.events.utils.console_formatter import ConsoleFormatter
from crewai.utilities.events.event_listener import EventListener
class TestRichLiveCleanup:
"""Test that Rich Live sessions are properly cleaned up after CrewAI operations."""
def test_logging_works_after_tree_rendering(self):
"""Test that logging output appears after tree rendering with proper cleanup."""
formatter = ConsoleFormatter()
tree = Tree("Test Flow")
formatter.print(tree)
assert formatter._live is not None
formatter.stop_live()
assert formatter._live is None
with patch.object(formatter.console, 'print') as mock_print:
formatter.print("This should appear immediately")
mock_print.assert_called_once_with("This should appear immediately")
def test_event_listener_cleanup_integration(self):
"""Test that EventListener properly cleans up Live sessions."""
event_listener = EventListener()
formatter = event_listener.formatter
tree = Tree("Test Crew")
formatter.print(tree)
assert formatter._live is not None
formatter.stop_live()
assert formatter._live is None
def test_stop_live_restores_normal_output(self):
"""Test that stop_live properly restores normal console output behavior."""
formatter = ConsoleFormatter()
tree = Tree("Test Tree")
formatter.print(tree)
assert formatter._live is not None
formatter.stop_live()
assert formatter._live is None
with patch.object(formatter.console, 'print') as mock_print:
formatter.print("Normal output")
mock_print.assert_called_once_with("Normal output")

View File

@@ -114,38 +114,3 @@ class TestConsoleFormatterPauseResume:
assert hasattr(formatter, '_live_paused')
assert not formatter._live_paused
def test_stop_live_with_active_session(self):
"""Test stopping Live session when one is active."""
formatter = ConsoleFormatter()
mock_live = MagicMock(spec=Live)
formatter._live = mock_live
formatter.stop_live()
mock_live.stop.assert_called_once()
assert formatter._live is None
def test_stop_live_with_no_session(self):
"""Test stopping Live session when none exists."""
formatter = ConsoleFormatter()
formatter._live = None
formatter.stop_live()
assert formatter._live is None
def test_stop_live_multiple_calls(self):
"""Test multiple calls to stop_live are safe."""
formatter = ConsoleFormatter()
mock_live = MagicMock(spec=Live)
formatter._live = mock_live
formatter.stop_live()
formatter.stop_live()
mock_live.stop.assert_called_once()
assert formatter._live is None

6351
uv.lock generated

File diff suppressed because it is too large Load Diff