codexapi 0.1.7__tar.gz → 0.1.8__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.1
2
2
  Name: codexapi
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Minimal Python API for running the Codex CLI.
5
5
  License: MIT
6
6
  Keywords: codex,agent,cli,openai
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codexapi"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Minimal Python API for running the Codex CLI."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -12,4 +12,4 @@ __all__ = [
12
12
  "task",
13
13
  "task_result",
14
14
  ]
15
- __version__ = "0.1.7"
15
+ __version__ = "0.1.8"
@@ -36,6 +36,7 @@ _COLUMN_TITLES = {
36
36
  "tok": "TOK/S",
37
37
  "in": "IN",
38
38
  "out": "OUT",
39
+ "turn": "TURN",
39
40
  "model": "MODEL",
40
41
  "effort": "EFF",
41
42
  "perm": "PERM",
@@ -309,6 +310,24 @@ def _format_token_total(value):
309
310
  return str(value)
310
311
 
311
312
 
313
+ def _format_duration(seconds):
314
+ if seconds is None:
315
+ return "-"
316
+ if seconds < 0:
317
+ return "-"
318
+ total = int(seconds)
319
+ days, rem = divmod(total, 86400)
320
+ hours, rem = divmod(rem, 3600)
321
+ minutes, secs = divmod(rem, 60)
322
+ if days:
323
+ return f"{days}d{hours:02d}h"
324
+ if hours:
325
+ return f"{hours}h{minutes:02d}m"
326
+ if minutes:
327
+ return f"{minutes}m{secs:02d}s"
328
+ return f"{secs}s"
329
+
330
+
312
331
  def _summarize_session(path, mtime):
313
332
  prompt = None
314
333
  prompt_fallback = None
@@ -569,6 +588,7 @@ def _layout_columns(width, id_width, show):
569
588
  ("tok", ">"),
570
589
  ("in", ">"),
571
590
  ("out", ">"),
591
+ ("turn", ">"),
572
592
  ]
573
593
  widths = {
574
594
  "id": id_width,
@@ -576,6 +596,7 @@ def _layout_columns(width, id_width, show):
576
596
  "tok": 7,
577
597
  "in": 7,
578
598
  "out": 7,
599
+ "turn": 7,
579
600
  }
580
601
  mins = {}
581
602
 
@@ -638,6 +659,16 @@ def _format_session(session, layout):
638
659
  status = "RUN" if session.get("status") == "running" else "IDLE"
639
660
  tok_s = session["tok_s"]
640
661
  tok_s_str = "-" if tok_s is None else f"{tok_s:5.1f}"
662
+ last_user_ts = session.get("last_user_ts")
663
+ last_agent_ts = session.get("last_agent_ts")
664
+ if status == "RUN":
665
+ turn_seconds = (datetime.now() - last_user_ts).total_seconds() if last_user_ts else None
666
+ else:
667
+ if last_user_ts and last_agent_ts:
668
+ turn_seconds = (last_agent_ts - last_user_ts).total_seconds()
669
+ else:
670
+ turn_seconds = None
671
+ turn_str = _format_duration(turn_seconds)
641
672
  meta = session.get("meta") or {}
642
673
  model = meta.get("model") or meta.get("model_provider") or "-"
643
674
  effort = meta.get("effort") or "-"
@@ -655,6 +686,7 @@ def _format_session(session, layout):
655
686
  "tok": tok_s_str,
656
687
  "in": total_in,
657
688
  "out": total_out,
689
+ "turn": turn_str,
658
690
  "model": _truncate_head(str(model), widths.get("model", 0)),
659
691
  "effort": _truncate_head(str(effort), widths.get("effort", 0)),
660
692
  "perm": _truncate_head(str(perm), widths.get("perm", 0)),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codexapi
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Minimal Python API for running the Codex CLI.
5
5
  License: MIT
6
6
  Keywords: codex,agent,cli,openai
File without changes
File without changes
File without changes
File without changes
File without changes