conduct-cli 0.4.13__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.13
3
+ Version: 0.4.14
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "conduct-cli"
7
- version = "0.4.13"
7
+ version = "0.4.14"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -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 _read_codex_tokens():
253
- """Read last_token_usage from the most recently modified Codex session file."""
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
- sessions_dir = Path.home() / ".codex" / "sessions"
256
- if not sessions_dir.exists():
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(files[0])
258
+ lines = _tail_lines(path)
262
259
  for line in reversed(lines):
263
260
  if "token_count" not in line:
264
261
  continue
@@ -292,10 +289,13 @@ def post_usage_main():
292
289
  tool_name = (data.get("tool_name") or "").lower()
293
290
  tool_use_id = data.get("tool_use_id")
294
291
  transcript_path = data.get("transcript_path")
295
- if transcript_path:
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:
296
296
  tokens_input, tokens_output = _read_tokens_from_transcript(transcript_path, tool_use_id)
297
297
  else:
298
- tokens_input, tokens_output = _read_codex_tokens()
298
+ tokens_input, tokens_output = 0, 0
299
299
  _post_usage(session_id, tool_name, tokens_input, tokens_output, None)
300
300
  sys.exit(0)
301
301
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.13
3
+ Version: 0.4.14
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
File without changes
File without changes
File without changes