conduct-cli 0.4.15__tar.gz → 0.4.16__tar.gz
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.
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/PKG-INFO +1 -1
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/pyproject.toml +1 -1
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli/guard.py +24 -16
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/README.md +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/setup.cfg +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/setup.py +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.15 → conduct_cli-0.4.16}/src/conduct_cli.egg-info/top_level.txt +0 -0
|
@@ -55,11 +55,14 @@ def _fetch_budget_status():
|
|
|
55
55
|
cfg = json.loads(CONFIG_PATH.read_text()) if CONFIG_PATH.exists() else {}
|
|
56
56
|
except Exception:
|
|
57
57
|
return False, None
|
|
58
|
-
workspace_id
|
|
59
|
-
|
|
58
|
+
workspace_id = cfg.get("workspace_id")
|
|
59
|
+
clerk_user_id = cfg.get("clerk_user_id") or ""
|
|
60
|
+
api_url = cfg.get("api_url", "https://api.conductai.ai").rstrip("/")
|
|
60
61
|
if not workspace_id:
|
|
61
62
|
return False, None
|
|
62
63
|
url = f"{api_url}/guard/spend/budget-check?workspace_id={workspace_id}"
|
|
64
|
+
if clerk_user_id:
|
|
65
|
+
url += f"&clerk_user_id={clerk_user_id}"
|
|
63
66
|
try:
|
|
64
67
|
with urllib.request.urlopen(urllib.request.Request(url), timeout=5) as resp:
|
|
65
68
|
data = json.loads(resp.read())
|
|
@@ -666,16 +669,18 @@ def cmd_guard_install(args):
|
|
|
666
669
|
print(f" {GRAY}Guard not installed for this workspace — skipping{RESET}")
|
|
667
670
|
return
|
|
668
671
|
|
|
669
|
-
member_token
|
|
670
|
-
user_email
|
|
672
|
+
member_token = result.get("member_token") or ""
|
|
673
|
+
user_email = result.get("user_email") or ""
|
|
674
|
+
clerk_user_id = result.get("clerk_user_id") or ""
|
|
671
675
|
|
|
672
676
|
# Persist guard config — include api_key so CLI commands can authenticate
|
|
673
677
|
_save_guard_config({
|
|
674
|
-
"workspace_id":
|
|
675
|
-
"member_token":
|
|
676
|
-
"user_email":
|
|
677
|
-
"
|
|
678
|
-
"
|
|
678
|
+
"workspace_id": workspace_id,
|
|
679
|
+
"member_token": member_token,
|
|
680
|
+
"user_email": user_email,
|
|
681
|
+
"clerk_user_id": clerk_user_id,
|
|
682
|
+
"api_key": api_key,
|
|
683
|
+
"api_url": server,
|
|
679
684
|
})
|
|
680
685
|
|
|
681
686
|
# Download policies
|
|
@@ -794,19 +799,22 @@ def cmd_guard_status(args):
|
|
|
794
799
|
api_key = cfg.get("api_key", "")
|
|
795
800
|
base_url = _api_url(cfg)
|
|
796
801
|
|
|
797
|
-
# Auto-refresh user_email into config if
|
|
798
|
-
if not user_email and api_key:
|
|
802
|
+
# Auto-refresh user_email + clerk_user_id into config if missing
|
|
803
|
+
if (not user_email or not cfg.get("clerk_user_id")) and api_key:
|
|
799
804
|
try:
|
|
800
805
|
installed = _req("GET", f"{base_url}/guard/config/installed", api_key=api_key)
|
|
801
806
|
fetched_email = installed.get("user_email") or ""
|
|
807
|
+
fetched_clerk = installed.get("clerk_user_id") or ""
|
|
802
808
|
if fetched_email:
|
|
803
809
|
cfg["user_email"] = fetched_email
|
|
804
|
-
_save_guard_config(cfg)
|
|
805
|
-
# Rewrite hook script so future events carry the email
|
|
806
|
-
hook_path = GUARD_DIR / "hook.py"
|
|
807
|
-
hook_path.write_text(_HOOK_SCRIPT)
|
|
808
|
-
hook_path.chmod(0o755)
|
|
809
810
|
user_email = fetched_email
|
|
811
|
+
if fetched_clerk:
|
|
812
|
+
cfg["clerk_user_id"] = fetched_clerk
|
|
813
|
+
_save_guard_config(cfg)
|
|
814
|
+
# Rewrite hook script so future events carry the email
|
|
815
|
+
hook_path = GUARD_DIR / "hook.py"
|
|
816
|
+
hook_path.write_text(_HOOK_SCRIPT)
|
|
817
|
+
hook_path.chmod(0o755)
|
|
810
818
|
except Exception:
|
|
811
819
|
pass
|
|
812
820
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|