aevs 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aevs/__init__.py ADDED
@@ -0,0 +1,99 @@
1
+ from aevs._version import __version__
2
+ from aevs.config import AEVSConfig, configure, reset_config
3
+ from aevs.exceptions import (
4
+ AEVSAuthError,
5
+ AEVSBufferError,
6
+ AEVSConfigError,
7
+ AEVSError,
8
+ AEVSSerializationError,
9
+ )
10
+
11
+ __all__ = [
12
+ "__version__",
13
+ "AEVSAuthError",
14
+ "AEVSBufferError",
15
+ "AEVSConfig",
16
+ "AEVSConfigError",
17
+ "AEVSError",
18
+ "AEVSSerializationError",
19
+ "clear_reference_ids",
20
+ "configure",
21
+ "disable",
22
+ "enable",
23
+ "flush",
24
+ "get_reference_id",
25
+ "get_reference_ids",
26
+ "get_session_id",
27
+ "is_healthy",
28
+ "reset_config",
29
+ ]
30
+
31
+
32
+ def enable(*, frameworks: list[str] | None = None) -> None:
33
+ """Detect installed frameworks and patch them to intercept tool calls."""
34
+ from aevs._api import enable as _enable
35
+
36
+ _enable(frameworks=frameworks)
37
+
38
+
39
+ def disable() -> None:
40
+ """Unpatch all frameworks, restore original behavior."""
41
+ from aevs._api import disable as _disable
42
+
43
+ _disable()
44
+
45
+
46
+ def flush() -> None:
47
+ """Force-send all buffered receipts to the backend."""
48
+ from aevs._api import flush as _flush
49
+
50
+ _flush()
51
+
52
+
53
+ def is_healthy(*, threshold: int = 3) -> bool:
54
+ """Return ``False`` when the receipt buffer has had *threshold* or more
55
+ consecutive write failures — indicating a sustained storage problem.
56
+
57
+ Safe to call at any time; never raises.
58
+ """
59
+ from aevs._api import is_healthy as _is_healthy
60
+
61
+ return _is_healthy(threshold=threshold)
62
+
63
+
64
+ def get_reference_id(lookup_id: str) -> str | None:
65
+ """Return the AEVS reference_id for a run_id or tool_call_id."""
66
+ from aevs._api import get_reference_id as _get
67
+
68
+ return _get(lookup_id)
69
+
70
+
71
+ def get_reference_ids(*, clear: bool = False) -> list[dict[str, str | int | None]]:
72
+ """Return all reference entries recorded since the last clear.
73
+
74
+ Pass ``clear=True`` to empty the registry after reading (recommended
75
+ for per-request web applications).
76
+ """
77
+ from aevs._api import get_reference_ids as _get
78
+
79
+ return _get(clear=clear)
80
+
81
+
82
+ def clear_reference_ids() -> None:
83
+ """Drop all stored reference entries."""
84
+ from aevs._api import clear_reference_ids as _clear
85
+
86
+ _clear()
87
+
88
+
89
+ def get_session_id() -> str | None:
90
+ """Return the active AEVS session UUID, or ``None`` when disabled.
91
+
92
+ A new UUIDv4 is minted on each ``enable()`` (or recovered from the
93
+ buffer on mid-session crash recovery). Useful for log correlation —
94
+ every receipt in the session carries this id and the chain anchor
95
+ is derived from it.
96
+ """
97
+ from aevs._api import get_session_id as _get
98
+
99
+ return _get()