fix(python): mirror official Gemini hooks
This commit is contained in:
1 parent
2d8111d823
commit
2f223dca73
15 files changed
+2359
-204
No files matched your search
@@ -1,22 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
|
||||
import pytest
|
||||
|
||||
from elydora.plugins.gemini import _is_elydora_hook as is_gemini_hook
|
||||
from elydora.plugins.letta import _is_elydora_hook as is_letta_hook
|
||||
|
||||
|
||||
HookDetector = Callable[[dict, str], bool]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("detector", [is_gemini_hook, is_letta_hook])
|
||||
def test_hook_detection_handles_only_string_commands(detector: HookDetector) -> None:
|
||||
assert detector({"command": 42}, "") is False
|
||||
assert detector({"hooks": [{"command": None}]}, "") is False
|
||||
assert detector({"hooks": [{"command": "run .elydora/agent-1/hook.py"}]}, "") is True
|
||||
assert detector(
|
||||
def test_hook_detection_handles_only_string_commands() -> None:
|
||||
assert is_letta_hook({"command": 42}, "") is False
|
||||
assert is_letta_hook({"hooks": [{"command": None}]}, "") is False
|
||||
assert is_letta_hook(
|
||||
{"hooks": [{"command": "run .elydora/agent-1/hook.py"}]}, ""
|
||||
) is True
|
||||
assert is_letta_hook(
|
||||
{"hooks": [{"command": "run .elydora/agent-1/hook.py"}]},
|
||||
"agent-2",
|
||||
) is False
|
||||
Reference in new issue
Block a user