cctally 1.72.0 → 1.74.0

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/_cctally_cache.py +271 -55
  3. package/bin/_cctally_core.py +20 -40
  4. package/bin/_cctally_dashboard.py +35 -1
  5. package/bin/_cctally_dashboard_conversation.py +731 -94
  6. package/bin/_cctally_dashboard_share.py +38 -3
  7. package/bin/_cctally_dashboard_sources.py +812 -74
  8. package/bin/_cctally_db.py +104 -1
  9. package/bin/_cctally_doctor.py +86 -4
  10. package/bin/_cctally_parser.py +17 -4
  11. package/bin/_cctally_record.py +162 -33
  12. package/bin/_cctally_refresh.py +58 -36
  13. package/bin/_cctally_source_analytics.py +288 -3
  14. package/bin/_cctally_statusline.py +811 -82
  15. package/bin/_cctally_transcript.py +223 -7
  16. package/bin/_cctally_tui.py +17 -14
  17. package/bin/_lib_aggregators.py +48 -34
  18. package/bin/_lib_codex_conversation_export.py +124 -0
  19. package/bin/_lib_codex_conversation_query.py +500 -28
  20. package/bin/_lib_codex_conversation_watch.py +323 -0
  21. package/bin/_lib_conversation_dispatch.py +269 -7
  22. package/bin/_lib_conversation_query.py +88 -0
  23. package/bin/_lib_dashboard_sources.py +20 -7
  24. package/bin/_lib_doctor.py +106 -0
  25. package/bin/_lib_jsonl.py +11 -0
  26. package/bin/_lib_pricing.py +7 -4
  27. package/bin/_lib_pricing_check.py +7 -1
  28. package/bin/_lib_quota.py +12 -11
  29. package/bin/_lib_statusline_candidates.py +734 -0
  30. package/bin/_lib_view_models.py +50 -14
  31. package/bin/cctally +31 -2
  32. package/dashboard/static/assets/index-DeQjEMO6.js +80 -0
  33. package/dashboard/static/assets/index-ZiPO8veo.css +1 -0
  34. package/dashboard/static/dashboard.html +2 -2
  35. package/package.json +4 -1
  36. package/dashboard/static/assets/index-BWadAHxC.js +0 -80
  37. package/dashboard/static/assets/index-D2nwo_ln.css +0 -1
@@ -1404,6 +1404,8 @@ def _build_codex_source_share_snapshot(ls, *, state, panel: str,
1404
1404
  raise ValueError("source capability unavailable")
1405
1405
  required_domain = {
1406
1406
  "current-week": "hero",
1407
+ "trend": "periods",
1408
+ "forecast": "quota",
1407
1409
  "daily": "periods",
1408
1410
  "monthly": "periods",
1409
1411
  "weekly": "periods",
@@ -1425,14 +1427,47 @@ def _build_codex_source_share_snapshot(ls, *, state, panel: str,
1425
1427
  source_rows = all_rows[-1:] if all_rows else ()
1426
1428
  command = "codex-weekly"
1427
1429
  display_tz = str(weekly.get("display_tz") or "UTC")
1428
- elif panel in ("daily", "monthly", "weekly"):
1430
+ elif panel in ("daily", "monthly", "weekly", "trend"):
1429
1431
  periods = data.get("periods")
1430
- panel_data = periods.get(panel) if isinstance(periods, Mapping) else {}
1432
+ period_key = "weekly" if panel == "trend" else panel
1433
+ panel_data = periods.get(period_key) if isinstance(periods, Mapping) else {}
1431
1434
  if not isinstance(panel_data, Mapping):
1432
1435
  raise ValueError("source capability unavailable")
1433
1436
  source_rows = tuple(panel_data.get("rows", ()))
1434
- command = f"codex-{panel}"
1437
+ command = f"codex-{period_key}"
1435
1438
  display_tz = str(panel_data.get("display_tz") or "UTC")
1439
+ elif panel == "forecast":
1440
+ quota = data.get("quota")
1441
+ panel_data = quota if isinstance(quota, Mapping) else {}
1442
+ source_rows = tuple(panel_data.get("histories", ())) if isinstance(panel_data, Mapping) else ()
1443
+ start, end = _share_codex_period_bounds(
1444
+ state=state, panel="weekly", options=options, rows=source_rows,
1445
+ )
1446
+ rows = []
1447
+ for row in source_rows:
1448
+ if not isinstance(row, Mapping):
1449
+ continue
1450
+ forecast = row.get("forecast") if isinstance(row.get("forecast"), Mapping) else {}
1451
+ current = row.get("current_percent")
1452
+ projected = forecast.get("projected_percent")
1453
+ rows.append(ls.Row(cells={
1454
+ "limit": ls.TextCell(str(row.get("label") or "Codex quota")),
1455
+ "current": ls.TextCell("—" if current is None else f"{float(current):.1f}%"),
1456
+ "projected": ls.TextCell("—" if projected is None else f"{float(projected):.1f}%"),
1457
+ }))
1458
+ return ls.ShareSnapshot(
1459
+ cmd="codex-quota", title="Codex Quota Forecast", subtitle=None,
1460
+ period=ls.PeriodSpec(start=start, end=end, display_tz="UTC", label=None),
1461
+ columns=(
1462
+ ls.ColumnSpec(key="limit", label="Limit"),
1463
+ ls.ColumnSpec(key="current", label="Current", align="right"),
1464
+ ls.ColumnSpec(key="projected", label="Projected", align="right"),
1465
+ ),
1466
+ rows=tuple(rows), chart=None, totals=(), notes=(), generated_at=end,
1467
+ version=sys.modules["cctally"]._share_resolve_version(),
1468
+ template_id=template_id, source="codex", source_label="Codex",
1469
+ availability=availability, availability_reason=reason,
1470
+ )
1436
1471
  elif panel == "sessions":
1437
1472
  panel_data = data.get(panel) if isinstance(data.get(panel), Mapping) else {}
1438
1473
  source_rows = tuple(panel_data.get("rows", ())) if isinstance(panel_data, Mapping) else ()