cctally 1.113.0 → 1.115.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 (97) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +4 -6
  3. package/bin/_cctally_account.py +32 -8
  4. package/bin/_cctally_cache.py +6035 -722
  5. package/bin/_cctally_completion.py +1287 -0
  6. package/bin/_cctally_config.py +37 -0
  7. package/bin/_cctally_core.py +400 -2
  8. package/bin/_cctally_dashboard.py +98 -20
  9. package/bin/_cctally_dashboard_conversation.py +292 -23
  10. package/bin/_cctally_dashboard_envelope.py +16 -3
  11. package/bin/_cctally_dashboard_perf.py +128 -9
  12. package/bin/_cctally_dashboard_sources.py +285 -213
  13. package/bin/_cctally_db.py +1177 -23
  14. package/bin/_cctally_diagnosis_sources.py +22 -4
  15. package/bin/_cctally_doctor.py +572 -45
  16. package/bin/_cctally_five_hour.py +84 -33
  17. package/bin/_cctally_forecast.py +108 -15
  18. package/bin/_cctally_journal.py +3950 -116
  19. package/bin/_cctally_journal_repair.py +101 -12
  20. package/bin/_cctally_milestone_history.py +82 -9
  21. package/bin/_cctally_parser.py +42 -0
  22. package/bin/_cctally_percent_breakdown.py +3 -2
  23. package/bin/_cctally_project.py +8 -2
  24. package/bin/_cctally_quarantine.py +652 -0
  25. package/bin/_cctally_quota.py +227 -37
  26. package/bin/_cctally_quota_model.py +360 -83
  27. package/bin/_cctally_record.py +691 -149
  28. package/bin/_cctally_rederive.py +320 -41
  29. package/bin/_cctally_refresh.py +84 -13
  30. package/bin/_cctally_source_analytics.py +83 -17
  31. package/bin/_cctally_statusline.py +6154 -517
  32. package/bin/_cctally_store.py +367 -53
  33. package/bin/_cctally_transcript.py +8 -7
  34. package/bin/_cctally_tui.py +61 -56
  35. package/bin/_cctally_weekrefs.py +128 -21
  36. package/bin/_lib_account_binding.py +152 -0
  37. package/bin/_lib_account_protocol.py +386 -0
  38. package/bin/_lib_aggregators.py +4 -0
  39. package/bin/_lib_cache_coverage.py +13 -1
  40. package/bin/_lib_cache_report.py +35 -6
  41. package/bin/_lib_cache_writer_lock.py +19 -3
  42. package/bin/_lib_clone_copy.py +142 -0
  43. package/bin/_lib_codex_conversation.py +32 -0
  44. package/bin/_lib_codex_conversation_query.py +297 -49
  45. package/bin/_lib_codex_conversation_watch.py +59 -14
  46. package/bin/_lib_codex_drain_admission.py +214 -0
  47. package/bin/_lib_codex_metadata.py +18 -1
  48. package/bin/_lib_codex_publication_barrier.py +277 -0
  49. package/bin/_lib_codex_rollout_container.py +502 -0
  50. package/bin/_lib_conversation_dispatch.py +3 -0
  51. package/bin/_lib_conversation_query.py +106 -59
  52. package/bin/_lib_conversation_retention.py +1605 -640
  53. package/bin/_lib_cost_provenance.py +53 -2
  54. package/bin/_lib_detector_access_registry.py +3817 -0
  55. package/bin/_lib_doctor.py +714 -69
  56. package/bin/_lib_five_hour.py +126 -0
  57. package/bin/_lib_fmt.py +11 -0
  58. package/bin/_lib_ingest_frontier.py +414 -20
  59. package/bin/_lib_journal.py +141 -10
  60. package/bin/_lib_jsonl.py +5 -4
  61. package/bin/_lib_legacy_spool.py +126 -0
  62. package/bin/_lib_legacy_writer_evidence.py +136 -0
  63. package/bin/_lib_merge_gate.py +231 -86
  64. package/bin/_lib_meter_rate_change.py +10 -0
  65. package/bin/_lib_outcome_quarantine.py +690 -0
  66. package/bin/_lib_perf.py +27 -1
  67. package/bin/_lib_pricing.py +199 -9
  68. package/bin/_lib_pricing_check.py +20 -4
  69. package/bin/_lib_quarantine.py +154 -0
  70. package/bin/_lib_quota_calibration.py +53 -8
  71. package/bin/_lib_quota_copy.py +2 -1
  72. package/bin/_lib_quota_model.py +288 -46
  73. package/bin/_lib_reclaim_planner.py +792 -0
  74. package/bin/_lib_rederive.py +319 -82
  75. package/bin/_lib_segment_summary.py +35 -2
  76. package/bin/_lib_snapshot_cache.py +21 -0
  77. package/bin/_lib_sqlite_close.py +81 -0
  78. package/bin/_lib_statusline_candidates.py +292 -23
  79. package/bin/_lib_subscription_weeks.py +100 -17
  80. package/bin/_lib_tick_stats.py +217 -17
  81. package/bin/_lib_wal_checkpoint.py +1077 -0
  82. package/bin/_lib_write_budget.py +483 -0
  83. package/bin/_lib_write_io.py +703 -0
  84. package/bin/cctally +31 -1
  85. package/dashboard/static/assets/{ConversationsView-CEZ-BUyi.js → ConversationsView-Bc8LCOAZ.js} +1 -1
  86. package/dashboard/static/assets/{DoctorModal-CE1oH_Zy.js → DoctorModal-D--qVBwe.js} +1 -1
  87. package/dashboard/static/assets/ModalRoot-DLPgyAM_.js +1 -0
  88. package/dashboard/static/assets/{ProjectsDrillPanel-B3DZoCeD.js → ProjectsDrillPanel-z53a4v4M.js} +1 -1
  89. package/dashboard/static/assets/{SourceDetailModal-CHp9EgLP.js → SourceDetailModal-Bw0T8W-W.js} +1 -1
  90. package/dashboard/static/assets/{UpdateModal-5iKST6jo.js → UpdateModal-D5AKx4Yw.js} +1 -1
  91. package/dashboard/static/assets/index-BKITk1CT.css +1 -0
  92. package/dashboard/static/assets/{index-Cm0VTxJC.js → index-BXDOzSng.js} +3 -3
  93. package/dashboard/static/assets/{outlineNavigation-DkXGL8J6.js → outlineNavigation-JObY7cUY.js} +1 -1
  94. package/dashboard/static/dashboard.html +2 -2
  95. package/package.json +19 -1
  96. package/dashboard/static/assets/ModalRoot-D5Y8IFUG.js +0 -1
  97. package/dashboard/static/assets/index-Dt4tqf43.css +0 -1
package/bin/cctally CHANGED
@@ -361,6 +361,13 @@ _SEMVER_RE = _lib_semver._SEMVER_RE
361
361
 
362
362
  _lib_pricing = _load_sibling("_lib_pricing")
363
363
  TIERED_THRESHOLD = _lib_pricing.TIERED_THRESHOLD
364
+ # #929: the whole-request (prompt-length) tier Claude Haiku 5.5 declares.
365
+ CLAUDE_WHOLE_REQUEST_THRESHOLD_KEY = _lib_pricing.CLAUDE_WHOLE_REQUEST_THRESHOLD_KEY
366
+ CLAUDE_WHOLE_REQUEST_THRESHOLD = _lib_pricing.CLAUDE_WHOLE_REQUEST_THRESHOLD
367
+ CLAUDE_WHOLE_REQUEST_TIER_FIELDS = _lib_pricing.CLAUDE_WHOLE_REQUEST_TIER_FIELDS
368
+ _select_claude_request_card = _lib_pricing._select_claude_request_card
369
+ claude_whole_request_declaration_problems = (
370
+ _lib_pricing.claude_whole_request_declaration_problems)
364
371
  CLAUDE_MODEL_PRICING = _lib_pricing.CLAUDE_MODEL_PRICING
365
372
  CLAUDE_FAST_MULTIPLIER_OVERRIDES = _lib_pricing.CLAUDE_FAST_MULTIPLIER_OVERRIDES
366
373
  CODEX_TIERED_THRESHOLD = _lib_pricing.CODEX_TIERED_THRESHOLD
@@ -485,6 +492,7 @@ _supports_unicode_stdout = _lib_fmt._supports_unicode_stdout
485
492
  _display_width = _lib_fmt._display_width
486
493
  _boxed_table = _lib_fmt._boxed_table
487
494
  _fmt_num = _lib_fmt._fmt_num
495
+ _fmt_usd_accounting = _lib_fmt._fmt_usd_accounting
488
496
  _truncate_num = _lib_fmt._truncate_num
489
497
  _ANSI_ESC_RE = _lib_fmt._ANSI_ESC_RE
490
498
  _truncate_display = _lib_fmt._truncate_display
@@ -545,6 +553,8 @@ _FIVE_HOUR_JITTER_FLOOR_SECONDS = _lib_five_hour._FIVE_HOUR_JITTER_FLOOR_SECONDS
545
553
  _floor_to_ten_minutes = _lib_five_hour._floor_to_ten_minutes
546
554
  _round_to_ten_minutes = _lib_five_hour._round_to_ten_minutes
547
555
  _canonical_5h_window_key = _lib_five_hour._canonical_5h_window_key
556
+ FiveHourReading = _lib_five_hour.FiveHourReading
557
+ latest_five_hour_reading = _lib_five_hour.latest_five_hour_reading
548
558
 
549
559
  _lib_subscription_weeks = _load_sibling("_lib_subscription_weeks")
550
560
  SubWeek = _lib_subscription_weeks.SubWeek
@@ -1162,6 +1172,7 @@ _collect_codex_entries_direct = _cctally_cache._collect_codex_entries_direct
1162
1172
  get_codex_entries = _cctally_cache.get_codex_entries
1163
1173
  _sum_codex_cost_for_range = _cctally_cache._sum_codex_cost_for_range
1164
1174
  get_entries = _cctally_cache.get_entries
1175
+ CodexHistoryUnavailable = _cctally_cache.CodexHistoryUnavailable
1165
1176
  AccountAttributionUnavailable = _cctally_cache.AccountAttributionUnavailable
1166
1177
  open_cache_db = _cctally_cache.open_cache_db
1167
1178
  open_conversations_db = _cctally_cache.open_conversations_db
@@ -1182,6 +1193,7 @@ sync_codex_conversations = _cctally_cache.sync_codex_conversations
1182
1193
  _reset_orphan_warning_throttle = _cctally_cache._reset_orphan_warning_throttle
1183
1194
  cmd_cache_sync = _cctally_cache.cmd_cache_sync
1184
1195
  cmd_codex_replay_drain_internal = _cctally_cache.cmd_codex_replay_drain_internal
1196
+ cmd_codex_prune_drain_internal = _cctally_cache.cmd_codex_prune_drain_internal
1185
1197
 
1186
1198
 
1187
1199
  # Record-usage / hook-tick hot-path subsystem — the runtime path that
@@ -1212,6 +1224,7 @@ maybe_record_codex_budget_milestone = _cctally_record.maybe_record_codex_budget_
1212
1224
  maybe_record_projected_alert = _cctally_record.maybe_record_projected_alert
1213
1225
  _weekly_pct_week_avg_projection = _cctally_record._weekly_pct_week_avg_projection
1214
1226
  _compute_block_totals = _cctally_record._compute_block_totals
1227
+ _block_pricing_provenance_json = _cctally_record._block_pricing_provenance_json
1215
1228
  # #620 S2 E2: the pure fold lifted out of _compute_block_totals, plus the
1216
1229
  # canonical priced record and bucket shapes it folds over.
1217
1230
  PricedEntry = _cctally_record.PricedEntry
@@ -1220,6 +1233,7 @@ BlockTotals = _cctally_record.BlockTotals
1220
1233
  fold_block_totals = _cctally_record.fold_block_totals
1221
1234
  maybe_update_five_hour_block = _cctally_record.maybe_update_five_hour_block
1222
1235
  cmd_record_usage = _cctally_record.cmd_record_usage
1236
+ record_usage_bound = _cctally_record.record_usage_bound
1223
1237
  CreditPlan = _cctally_record.CreditPlan
1224
1238
  _parse_credit_at = _cctally_record._parse_credit_at
1225
1239
  _build_credit_plan = _cctally_record._build_credit_plan
@@ -1227,6 +1241,9 @@ _resolve_reset_aware_hwm = _cctally_record._resolve_reset_aware_hwm
1227
1241
  _insert_credit_snapshot = _cctally_record._insert_credit_snapshot
1228
1242
  _resolve_prior_5h = _cctally_record._resolve_prior_5h
1229
1243
  _resolve_active_five_hour_reset_event_id = _cctally_record._resolve_active_five_hour_reset_event_id
1244
+ resolve_five_hour_reset_event = _cctally_record.resolve_five_hour_reset_event
1245
+ FiveHourResetEvent = _cctally_record.FiveHourResetEvent
1246
+ NoFiveHourResetEvent = _cctally_record.NoFiveHourResetEvent
1230
1247
  _apply_credit = _cctally_record._apply_credit
1231
1248
  _fire_in_place_credit = _cctally_record._fire_in_place_credit
1232
1249
  detect_reset_and_credit = _cctally_record.detect_reset_and_credit
@@ -1616,6 +1633,11 @@ CLAUDE_MODEL_CONTEXT_WINDOWS = _cctally_statusline.CLAUDE_MODEL_CONTEXT_WINDOWS
1616
1633
  CLAUDE_MODEL_CONTEXT_WINDOW_DEFAULT_FAMILY = _cctally_statusline.CLAUDE_MODEL_CONTEXT_WINDOW_DEFAULT_FAMILY
1617
1634
  _resolve_statusline_tz = _cctally_statusline._resolve_statusline_tz
1618
1635
  cmd_statusline = _cctally_statusline.cmd_statusline
1636
+ # #825/#832 spec 4.3 revision 2: the hidden detached continuation worker and
1637
+ # dependency waiter.
1638
+ cmd_statusline_continue_internal = (
1639
+ _cctally_statusline.cmd_statusline_continue_internal
1640
+ )
1619
1641
  _resolve_context_window = _cctally_statusline._resolve_context_window
1620
1642
  _read_last_assistant_usage = _cctally_statusline._read_last_assistant_usage
1621
1643
  _build_statusline_injections = _cctally_statusline._build_statusline_injections
@@ -1647,6 +1669,8 @@ _authoritative_repair_required = _cctally_statusline._authoritative_repair_requi
1647
1669
  _after_authoritative_record = _cctally_statusline._after_authoritative_record
1648
1670
  _statusline_reduce_and_publish = _cctally_statusline._statusline_reduce_and_publish
1649
1671
  _build_publication_plan = _cctally_statusline._build_publication_plan
1672
+ _statusline_tombstone_states = _cctally_statusline._statusline_tombstone_states
1673
+ _capture_binding = _cctally_statusline._capture_binding
1650
1674
 
1651
1675
 
1652
1676
  # Eager re-export of bin/_cctally_codex.py — the four cmd_codex_* are the
@@ -1743,6 +1767,8 @@ BudgetRow = _cctally_forecast.BudgetRow
1743
1767
  _resolve_forecast_now = _cctally_forecast._resolve_forecast_now
1744
1768
  _fetch_current_week_snapshots = _cctally_forecast._fetch_current_week_snapshots
1745
1769
  _apply_midweek_reset_override = _cctally_forecast._apply_midweek_reset_override
1770
+ _current_week_five_hour_percent = _cctally_forecast._current_week_five_hour_percent
1771
+ _current_week_five_hour_reading = _cctally_forecast._current_week_five_hour_reading
1746
1772
  _resolve_current_budget_window = _cctally_forecast._resolve_current_budget_window
1747
1773
  _build_budget_status_inputs = _cctally_forecast._build_budget_status_inputs
1748
1774
  _build_vendor_budget_inputs = _cctally_forecast._build_vendor_budget_inputs
@@ -3658,6 +3684,9 @@ def main(argv: list[str] | None = None) -> int:
3658
3684
  # not print a partial report".
3659
3685
  eprint(f"cctally: {exc}")
3660
3686
  return 3
3687
+ except CodexHistoryUnavailable as exc:
3688
+ eprint(str(exc))
3689
+ return 3
3661
3690
  except AccountAttributionUnavailable as exc:
3662
3691
  # #341: a `--account`-scoped entry read hit a query-time cache degrade
3663
3692
  # (open failure / concurrent ingest) that would drop the account
@@ -3805,7 +3834,8 @@ def _post_command_update_hooks(command: str | None, args) -> None:
3805
3834
  return
3806
3835
  if command in ("_update-check", "_telemetry-beat", "_codex-quota-verify",
3807
3836
  "_stats-epoch-rebuild", "_stats-corruption-heal",
3808
- "_codex-replay-drain", "_artifact-retention"):
3837
+ "_codex-replay-drain", "_codex-prune-drain", "_artifact-retention",
3838
+ "_statusline-continue"):
3809
3839
  # All six hidden workers are detached and have already done their one job
3810
3840
  # in their own command handler; none must re-enter this hook.
3811
3841
  # Without the guard the ``_update-check`` worker would fall through to