conduct-cli 0.4.98__tar.gz → 0.4.99__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.98 → conduct_cli-0.4.99}/PKG-INFO +1 -1
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/pyproject.toml +1 -1
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/hook_template.py +26 -5
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/README.md +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/setup.cfg +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/setup.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/guard.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/hook_precompact_template.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/hook_session_start_template.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/hook_stop_template.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/mcp_server.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/memory.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli/paxel.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/src/conduct_cli.egg-info/top_level.txt +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/tests/test_guard_policy.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/tests/test_guard_savings.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/tests/test_hook_syntax.py +0 -0
- {conduct_cli-0.4.98 → conduct_cli-0.4.99}/tests/test_switch.py +0 -0
|
@@ -8,6 +8,27 @@ import time
|
|
|
8
8
|
import urllib.request
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
+
_FLUSH_INTERVAL = 8 * 3600
|
|
12
|
+
_FLUSH_STAMP = Path.home() / ".conduct" / "last_memory_flush"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _should_periodic_flush() -> bool:
|
|
16
|
+
try:
|
|
17
|
+
if not _FLUSH_STAMP.exists():
|
|
18
|
+
return True
|
|
19
|
+
return time.time() - float(_FLUSH_STAMP.read_text().strip()) >= _FLUSH_INTERVAL
|
|
20
|
+
except Exception:
|
|
21
|
+
return True
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _mark_flushed() -> None:
|
|
25
|
+
try:
|
|
26
|
+
_FLUSH_STAMP.parent.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
_FLUSH_STAMP.write_text(str(time.time()))
|
|
28
|
+
except Exception:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
11
32
|
GUARD_DIR = Path.home() / ".conductguard"
|
|
12
33
|
POLICY_PATH = GUARD_DIR / "policy.json"
|
|
13
34
|
CONFIG_PATH = GUARD_DIR / "config.json"
|
|
@@ -589,19 +610,19 @@ def main():
|
|
|
589
610
|
session_id = data.get("session_id", "")
|
|
590
611
|
transcript_path = data.get("transcript_path")
|
|
591
612
|
repo = _detect_repo()
|
|
592
|
-
from conduct_cli.memory import post_session_to_api
|
|
613
|
+
from conduct_cli.memory import post_session_to_api
|
|
593
614
|
post_session_to_api(session_id, transcript_path, repo)
|
|
594
|
-
|
|
615
|
+
_mark_flushed()
|
|
595
616
|
sys.exit(0)
|
|
596
617
|
|
|
597
618
|
# Periodic flush — fire at most once every 8 hours mid-session
|
|
598
|
-
|
|
599
|
-
if should_periodic_flush():
|
|
619
|
+
if _should_periodic_flush():
|
|
600
620
|
session_id = data.get("session_id", "")
|
|
601
621
|
transcript_path = data.get("transcript_path")
|
|
602
622
|
repo = _detect_repo()
|
|
623
|
+
from conduct_cli.memory import post_session_to_api
|
|
603
624
|
post_session_to_api(session_id, transcript_path, repo)
|
|
604
|
-
|
|
625
|
+
_mark_flushed()
|
|
605
626
|
|
|
606
627
|
# Policy version check (cached 60s) — auto-syncs if server version differs
|
|
607
628
|
_maybe_sync_policy()
|
|
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
|
|
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
|