conduct-cli 0.4.12__tar.gz → 0.4.14__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.12 → conduct_cli-0.4.14}/PKG-INFO +1 -1
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/pyproject.toml +1 -1
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli/guard.py +14 -10
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/README.md +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/setup.cfg +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/setup.py +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.12 → conduct_cli-0.4.14}/src/conduct_cli.egg-info/top_level.txt +0 -0
|
@@ -249,16 +249,13 @@ def _read_tokens_from_transcript(transcript_path, tool_use_id):
|
|
|
249
249
|
return 0, 0
|
|
250
250
|
|
|
251
251
|
|
|
252
|
-
def
|
|
253
|
-
"""Read last_token_usage from
|
|
252
|
+
def _read_codex_tokens_from_transcript(transcript_path):
|
|
253
|
+
"""Read last_token_usage from a Codex session JSONL (event_msg/token_count entries)."""
|
|
254
254
|
try:
|
|
255
|
-
|
|
256
|
-
if not
|
|
257
|
-
return 0, 0
|
|
258
|
-
files = sorted(sessions_dir.rglob("*.jsonl"), key=lambda p: p.stat().st_mtime, reverse=True)
|
|
259
|
-
if not files:
|
|
255
|
+
path = Path(transcript_path)
|
|
256
|
+
if not path.exists():
|
|
260
257
|
return 0, 0
|
|
261
|
-
lines = _tail_lines(
|
|
258
|
+
lines = _tail_lines(path)
|
|
262
259
|
for line in reversed(lines):
|
|
263
260
|
if "token_count" not in line:
|
|
264
261
|
continue
|
|
@@ -284,14 +281,21 @@ def post_usage_main():
|
|
|
284
281
|
data = json.load(sys.stdin)
|
|
285
282
|
except Exception:
|
|
286
283
|
sys.exit(0)
|
|
284
|
+
try:
|
|
285
|
+
(GUARD_DIR / "debug_post.json").write_text(json.dumps(data, indent=2))
|
|
286
|
+
except Exception:
|
|
287
|
+
pass
|
|
287
288
|
session_id = data.get("session_id")
|
|
288
289
|
tool_name = (data.get("tool_name") or "").lower()
|
|
289
290
|
tool_use_id = data.get("tool_use_id")
|
|
290
291
|
transcript_path = data.get("transcript_path")
|
|
291
|
-
|
|
292
|
+
is_codex = (tool_use_id or "").startswith("call_")
|
|
293
|
+
if transcript_path and is_codex:
|
|
294
|
+
tokens_input, tokens_output = _read_codex_tokens_from_transcript(transcript_path)
|
|
295
|
+
elif transcript_path:
|
|
292
296
|
tokens_input, tokens_output = _read_tokens_from_transcript(transcript_path, tool_use_id)
|
|
293
297
|
else:
|
|
294
|
-
tokens_input, tokens_output =
|
|
298
|
+
tokens_input, tokens_output = 0, 0
|
|
295
299
|
_post_usage(session_id, tool_name, tokens_input, tokens_output, None)
|
|
296
300
|
sys.exit(0)
|
|
297
301
|
|
|
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
|