contextspy 0.6.2__tar.gz → 0.6.4__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.
Files changed (118) hide show
  1. {contextspy-0.6.2/contextspy.egg-info → contextspy-0.6.4}/PKG-INFO +12 -3
  2. {contextspy-0.6.2 → contextspy-0.6.4}/README.md +11 -2
  3. contextspy-0.6.4/contextspy/_web/assets/index-BmHaaAAy.js +135 -0
  4. contextspy-0.6.4/contextspy/_web/assets/index-DNmOpD9i.css +1 -0
  5. contextspy-0.6.2/contextspy/_web/assets/index.es-BdSrsOfF.js → contextspy-0.6.4/contextspy/_web/assets/index.es-BbkcEyVL.js +1 -1
  6. contextspy-0.6.2/contextspy/_web/assets/jspdf.es.min-DFSN23u9.js → contextspy-0.6.4/contextspy/_web/assets/jspdf.es.min-BOazG9J-.js +4 -4
  7. contextspy-0.6.4/contextspy/_web/assets/purify.es-CAi2OJFm.js +3 -0
  8. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/_web/index.html +2 -2
  9. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/anthropic.py +14 -10
  10. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/base.py +20 -44
  11. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/ollama.py +16 -7
  12. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/openai_chat.py +14 -13
  13. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/openai_responses.py +63 -27
  14. contextspy-0.6.4/contextspy/analysis/media.py +444 -0
  15. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/sessions.py +47 -4
  16. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/cli.py +27 -0
  17. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/crud.py +55 -11
  18. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/hotspots_service.py +122 -41
  19. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/migrations.py +190 -1
  20. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/session_archive.py +18 -0
  21. {contextspy-0.6.2 → contextspy-0.6.4/contextspy.egg-info}/PKG-INFO +12 -3
  22. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy.egg-info/SOURCES.txt +9 -5
  23. {contextspy-0.6.2 → contextspy-0.6.4}/pyproject.toml +1 -1
  24. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_file_paths.py +1 -1
  25. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_hotspots.py +93 -0
  26. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_invocation_normalization.py +10 -14
  27. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_json_path.py +3 -3
  28. contextspy-0.6.4/tests/test_media.py +239 -0
  29. contextspy-0.6.4/tests/test_media_migration.py +109 -0
  30. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_migrations.py +6 -6
  31. contextspy-0.6.4/tests/test_session_reopen.py +229 -0
  32. contextspy-0.6.2/contextspy/_web/assets/index-BcTAYVJp.css +0 -1
  33. contextspy-0.6.2/contextspy/_web/assets/index-DVhEeneC.js +0 -135
  34. contextspy-0.6.2/contextspy/_web/assets/purify.es-DedTAGkB.js +0 -3
  35. {contextspy-0.6.2 → contextspy-0.6.4}/LICENSE +0 -0
  36. {contextspy-0.6.2 → contextspy-0.6.4}/MANIFEST.in +0 -0
  37. {contextspy-0.6.2 → contextspy-0.6.4}/NOTICE +0 -0
  38. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/__init__.py +0 -0
  39. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/__main__.py +0 -0
  40. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/_web/assets/html2canvas.esm-QH1iLAAe.js +0 -0
  41. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/_web/assets/jspdf.plugin.autotable-Cz_YoQo_.js +0 -0
  42. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/_web/logo_small_wl.png +0 -0
  43. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/__init__.py +0 -0
  44. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/accounting.py +0 -0
  45. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/activity.py +0 -0
  46. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/adapters/__init__.py +0 -0
  47. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/block_hotspots.py +0 -0
  48. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/block_occurrences.py +0 -0
  49. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/blocks.py +0 -0
  50. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/capture.py +0 -0
  51. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/classifier.py +0 -0
  52. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/context_diff.py +0 -0
  53. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/conversation_projection.py +0 -0
  54. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/invocations.py +0 -0
  55. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/lineage.py +0 -0
  56. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/lineage_types.py +0 -0
  57. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/paths.py +0 -0
  58. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/purpose.py +0 -0
  59. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/sources.py +0 -0
  60. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/stream_hint.py +0 -0
  61. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/analysis/tokenizer.py +0 -0
  62. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/__init__.py +0 -0
  63. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/main.py +0 -0
  64. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/__init__.py +0 -0
  65. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/proxy.py +0 -0
  66. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/requests.py +0 -0
  67. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/stats.py +0 -0
  68. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/routers/tokenize.py +0 -0
  69. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/api/websocket.py +0 -0
  70. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/config.py +0 -0
  71. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/__init__.py +0 -0
  72. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/backups.py +0 -0
  73. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/block_occurrence_service.py +0 -0
  74. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/compaction.py +0 -0
  75. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/database.py +0 -0
  76. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/maintenance_lock.py +0 -0
  77. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/models.py +0 -0
  78. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/session_lineage_service.py +0 -0
  79. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/switching.py +0 -0
  80. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/db/trend_service.py +0 -0
  81. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/normalization.py +0 -0
  82. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/__init__.py +0 -0
  83. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/addon.py +0 -0
  84. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/capture_state.py +0 -0
  85. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/capture_writer.py +0 -0
  86. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/cert.py +0 -0
  87. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/runner.py +0 -0
  88. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/ws_protocols/__init__.py +0 -0
  89. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/ws_protocols/base.py +0 -0
  90. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy/proxy/ws_protocols/codex.py +0 -0
  91. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy.egg-info/dependency_links.txt +0 -0
  92. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy.egg-info/entry_points.txt +0 -0
  93. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy.egg-info/requires.txt +0 -0
  94. {contextspy-0.6.2 → contextspy-0.6.4}/contextspy.egg-info/top_level.txt +0 -0
  95. {contextspy-0.6.2 → contextspy-0.6.4}/setup.cfg +0 -0
  96. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_anthropic_thread_normalization.py +0 -0
  97. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_backups.py +0 -0
  98. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_block_occurrences.py +0 -0
  99. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_capture_pause.py +0 -0
  100. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_classification.py +0 -0
  101. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_context_diff_equivalence.py +0 -0
  102. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_dashboard_stats.py +0 -0
  103. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_db_compact.py +0 -0
  104. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_db_lock.py +0 -0
  105. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_db_switch.py +0 -0
  106. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_lineage.py +0 -0
  107. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_lineage_revision_memo.py +0 -0
  108. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_providers.py +0 -0
  109. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_request_filters.py +0 -0
  110. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_schema_v9.py +0 -0
  111. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_session_archive.py +0 -0
  112. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_session_trend.py +0 -0
  113. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_stats.py +0 -0
  114. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_stream_hint.py +0 -0
  115. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_tokenize.py +0 -0
  116. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_v9_backfill.py +0 -0
  117. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_volatile_header.py +0 -0
  118. {contextspy-0.6.2 → contextspy-0.6.4}/tests/test_ws_protocols.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contextspy
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Context profiler for LLMs and AI agents - used to inspect context conents and reduce token costs
5
5
  Author-email: Rimantas Zukaitis <rimasz@gmail.com>
6
6
  License:
@@ -264,7 +264,7 @@ changes between multiple requests in the same session. Modern AI coding agents (
264
264
  the context limit. ContextSpy makes the invisible visible - you see a live breakdown of
265
265
  every token category for every request, across sessions, over time.
266
266
 
267
- <p align="center"><strong>Example dashboard view</strong><br><img src="docs/_static/dashboard.png" alt="Dashboard view"></p>
267
+ <p align="center"><strong>Watch the demo</strong><br><a href="https://www.youtube.com/watch?v=hyd9jm-v73E"><img src="https://img.youtube.com/vi/hyd9jm-v73E/maxresdefault.jpg" alt="ContextSpy demo video" width="720"></a></p>
268
268
 
269
269
  Think of your favorite CPU or memory profiler, just applied to the contents of the context of an AI agent. While you can optimize performance just by reviewing code, having a profiler to capture and visualise snapshot data helps a lot. Same with LLM context optimisation.
270
270
 
@@ -274,6 +274,8 @@ Quick setup for macOS (Apple Silicon) — see [install guide](docs/install.md) f
274
274
  ```bash
275
275
  # install latest binary release with Homebrew
276
276
  brew tap RimantasZ/contextspy
277
+ # optional - sometimes Homebrew requires trusting the tap before installing
278
+ brew trust RimantasZ/contextspy
277
279
  brew install contextspy
278
280
 
279
281
  # Install CA certificate into system trust store (one-time, cloud mode only)
@@ -337,9 +339,11 @@ database. A local web server serves the dashboard used to explore the captured d
337
339
 
338
340
  ## Some screenshots
339
341
 
342
+ <p align="center"><strong>Example dashboard view</strong><br><img src="docs/_static/dashboard.png" alt="Dashboard view"></p>
343
+
340
344
  <p align="center"><strong>Request view</strong><br><img src="docs/_static/request.png" alt="Request view"></p>
341
345
 
342
- <p align="center"><strong>Context breakdown</strong><br><img src="docs/_static/request2.png" alt="Context breakdown"></p>
346
+ <p align="center"><strong>Hotspots</strong><br><img src="docs/_static/hotspots.png" alt="Context breakdown"></p>
343
347
 
344
348
  <p align="center"><strong>Session view</strong><br><img src="docs/_static/session.png" alt="Session view"></p>
345
349
 
@@ -371,6 +375,8 @@ The new version can be installed with homebrew:
371
375
  ```bash
372
376
  ## optional - sometimes brew "forgets" custom tap, add it again if just update fails
373
377
  brew tap RimantasZ/contextspy
378
+ ## optional - sometimes Homebrew requires trusting the tap before upgrading
379
+ brew trust RimantasZ/contextspy
374
380
  ## update homebrew and upgrade contextspy
375
381
  brew update
376
382
  brew upgrade contextspy
@@ -404,6 +410,9 @@ If that name already exists, `-1`, `-2`, and so on is added before `.back`.
404
410
  - **Context breakdown** — input tokens split into 8 categories:
405
411
  system prompt, tool definitions, tool results, file contents, conversation history,
406
412
  current user message, assistant prefill, uncategorised
413
+ - **Hotspot analysis** — helps to identify what elements in context use most tokens over
414
+ lifespan of whole agentic sessions
415
+ current user message, assistant prefill, uncategorised
407
416
  - **Live dashboard** — responsive light/dark charts, tool-use treemaps, and a request workbench
408
417
  with compact, relative-size, and raw payload views plus block search and inspection
409
418
  - **Session tracking** — name time windows, keep stable per-session request numbers, and compare
@@ -26,7 +26,7 @@ changes between multiple requests in the same session. Modern AI coding agents (
26
26
  the context limit. ContextSpy makes the invisible visible - you see a live breakdown of
27
27
  every token category for every request, across sessions, over time.
28
28
 
29
- <p align="center"><strong>Example dashboard view</strong><br><img src="docs/_static/dashboard.png" alt="Dashboard view"></p>
29
+ <p align="center"><strong>Watch the demo</strong><br><a href="https://www.youtube.com/watch?v=hyd9jm-v73E"><img src="https://img.youtube.com/vi/hyd9jm-v73E/maxresdefault.jpg" alt="ContextSpy demo video" width="720"></a></p>
30
30
 
31
31
  Think of your favorite CPU or memory profiler, just applied to the contents of the context of an AI agent. While you can optimize performance just by reviewing code, having a profiler to capture and visualise snapshot data helps a lot. Same with LLM context optimisation.
32
32
 
@@ -36,6 +36,8 @@ Quick setup for macOS (Apple Silicon) — see [install guide](docs/install.md) f
36
36
  ```bash
37
37
  # install latest binary release with Homebrew
38
38
  brew tap RimantasZ/contextspy
39
+ # optional - sometimes Homebrew requires trusting the tap before installing
40
+ brew trust RimantasZ/contextspy
39
41
  brew install contextspy
40
42
 
41
43
  # Install CA certificate into system trust store (one-time, cloud mode only)
@@ -99,9 +101,11 @@ database. A local web server serves the dashboard used to explore the captured d
99
101
 
100
102
  ## Some screenshots
101
103
 
104
+ <p align="center"><strong>Example dashboard view</strong><br><img src="docs/_static/dashboard.png" alt="Dashboard view"></p>
105
+
102
106
  <p align="center"><strong>Request view</strong><br><img src="docs/_static/request.png" alt="Request view"></p>
103
107
 
104
- <p align="center"><strong>Context breakdown</strong><br><img src="docs/_static/request2.png" alt="Context breakdown"></p>
108
+ <p align="center"><strong>Hotspots</strong><br><img src="docs/_static/hotspots.png" alt="Context breakdown"></p>
105
109
 
106
110
  <p align="center"><strong>Session view</strong><br><img src="docs/_static/session.png" alt="Session view"></p>
107
111
 
@@ -133,6 +137,8 @@ The new version can be installed with homebrew:
133
137
  ```bash
134
138
  ## optional - sometimes brew "forgets" custom tap, add it again if just update fails
135
139
  brew tap RimantasZ/contextspy
140
+ ## optional - sometimes Homebrew requires trusting the tap before upgrading
141
+ brew trust RimantasZ/contextspy
136
142
  ## update homebrew and upgrade contextspy
137
143
  brew update
138
144
  brew upgrade contextspy
@@ -166,6 +172,9 @@ If that name already exists, `-1`, `-2`, and so on is added before `.back`.
166
172
  - **Context breakdown** — input tokens split into 8 categories:
167
173
  system prompt, tool definitions, tool results, file contents, conversation history,
168
174
  current user message, assistant prefill, uncategorised
175
+ - **Hotspot analysis** — helps to identify what elements in context use most tokens over
176
+ lifespan of whole agentic sessions
177
+ current user message, assistant prefill, uncategorised
169
178
  - **Live dashboard** — responsive light/dark charts, tool-use treemaps, and a request workbench
170
179
  with compact, relative-size, and raw payload views plus block search and inspection
171
180
  - **Session tracking** — name time windows, keep stable per-session request numbers, and compare