yohanun 0.26.2__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.
yohanun/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ """Yohanun Guilds — persistent, access-governed memory for Claude Code agents.
2
+
3
+ You and your agents form a GUILD: one tenant per user/org, named agents with
4
+ memory of their own (one per project by default; an agent can run several
5
+ related projects on one memory); memories owner-walled per agent,
6
+ compartmented by a matter per project, with a shared guild circle for
7
+ cross-project knowledge and addressed letters between agents. Retrieval is
8
+ decided by the platform gate (identity + ledger-held keys + clearances) —
9
+ never client-side.
10
+ """
11
+
12
+ __version__ = "0.26.2"
yohanun/api.py ADDED
@@ -0,0 +1,40 @@
1
+ """Thin HTTP client for the Yohanun API. Two flavors:
2
+
3
+ - request(): returns (status, json) so provisioning code can branch on
4
+ 409/403 without exceptions.
5
+ - call(): exits with a readable error on any non-2xx — right for the
6
+ memory commands where any failure is terminal for the CLI invocation.
7
+ """
8
+ import sys
9
+
10
+ import requests
11
+
12
+ from . import __version__
13
+
14
+
15
+ def request(cfg: dict, method: str, path: str, body: dict = None,
16
+ timeout: int = 30):
17
+ try:
18
+ r = requests.request(
19
+ method, cfg["base_url"] + path, json=body, timeout=timeout,
20
+ headers={"X-API-Key": cfg["api_key"],
21
+ "Content-Type": "application/json",
22
+ "User-Agent": f"yohanun-kit/{__version__}"})
23
+ except requests.RequestException as e:
24
+ print(f"ERROR: Yohanun unreachable at {cfg['base_url']} "
25
+ f"({e.__class__.__name__})", file=sys.stderr)
26
+ sys.exit(1)
27
+ try:
28
+ payload = r.json()
29
+ except ValueError:
30
+ payload = {"raw": r.text[:300]}
31
+ return r.status_code, payload
32
+
33
+
34
+ def call(cfg: dict, method: str, path: str, body: dict = None,
35
+ timeout: int = 45) -> dict:
36
+ status, payload = request(cfg, method, path, body, timeout=timeout)
37
+ if status >= 300:
38
+ print(f"ERROR: {path} -> {status}: {str(payload)[:300]}", file=sys.stderr)
39
+ sys.exit(1)
40
+ return payload