entelligence-cli 0.1.232__tar.gz → 0.1.233__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 (193) hide show
  1. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/PKG-INFO +1 -1
  2. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/insights.py +69 -18
  3. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/facts_envelope.py +102 -8
  4. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/PKG-INFO +1 -1
  5. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/pyproject.toml +1 -1
  6. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_facts_envelope.py +163 -0
  7. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_sync_pushes_built_sessions.py +71 -9
  8. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/README.md +0 -0
  9. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/__init__.py +0 -0
  10. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/__init__.py +0 -0
  11. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/__init__.py +0 -0
  12. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/__init__.py +0 -0
  13. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/__init__.py +0 -0
  14. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_paths.py +0 -0
  15. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_segmentation_prompts/system.j2 +0 -0
  16. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_segmentation_prompts/user.j2 +0 -0
  17. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/__init__.py +0 -0
  18. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/_base.py +0 -0
  19. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/_jsonl_utils.py +0 -0
  20. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/entireio/__init__.py +0 -0
  21. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/entireio/git_reader.py +0 -0
  22. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/entireio/models.py +0 -0
  23. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/entireio/parser.py +0 -0
  24. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/entireio/source.py +0 -0
  25. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/factory.py +0 -0
  26. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/__init__.py +0 -0
  27. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/__init__.py +0 -0
  28. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/base.py +0 -0
  29. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/claude_code.py +0 -0
  30. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/codex.py +0 -0
  31. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/copilot.py +0 -0
  32. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/cursor_agent_transcript.py +0 -0
  33. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/cursor_store.py +0 -0
  34. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/kiro.py +0 -0
  35. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/parsers/opencode.py +0 -0
  36. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/_sources/local/source.py +0 -0
  37. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/behavior_signals.py +0 -0
  38. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/file_paths.py +0 -0
  39. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/metrics.py +0 -0
  40. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/segment_orchestrator.py +0 -0
  41. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/segment_pure.py +0 -0
  42. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/session_pure.py +0 -0
  43. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/skill_names.py +0 -0
  44. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/ingestion/coding_agent/spans.py +0 -0
  45. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/pricing.py +0 -0
  46. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/vocabulary/__init__.py +0 -0
  47. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/vocabulary/categories.py +0 -0
  48. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/vocabulary/edges.py +0 -0
  49. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/_vendor/memory_core/vocabulary/nodes.py +0 -0
  50. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/agent_insights_proxy.py +0 -0
  51. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/agent_insights_segment.py +0 -0
  52. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/api_client.py +0 -0
  53. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ascii-art.txt +0 -0
  54. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/browser_login.py +0 -0
  55. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/cli.py +0 -0
  56. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/__init__.py +0 -0
  57. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/auth.py +0 -0
  58. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/budget.py +0 -0
  59. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/config.py +0 -0
  60. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/cursor_doctor.py +0 -0
  61. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/incident.py +0 -0
  62. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/mcp.py +0 -0
  63. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/reset.py +0 -0
  64. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/review.py +0 -0
  65. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/router.py +0 -0
  66. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/security.py +0 -0
  67. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/skills.py +0 -0
  68. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/commands/update.py +0 -0
  69. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/config.py +0 -0
  70. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/cursor_path_a_usage.py +0 -0
  71. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/diagnostics.py +0 -0
  72. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/exceptions.py +0 -0
  73. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/git_operations.py +0 -0
  74. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/hooks/__init__.py +0 -0
  75. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/hooks/capacity_emit.py +0 -0
  76. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/hooks/session_brief.py +0 -0
  77. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/hooks/standup_emit.py +0 -0
  78. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/insights_log.py +0 -0
  79. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/platform_env.py +0 -0
  80. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/__init__.py +0 -0
  81. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/bedrock.py +0 -0
  82. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/catalog.py +0 -0
  83. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/claude_settings.py +0 -0
  84. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/codex_auth.py +0 -0
  85. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/codex_settings.py +0 -0
  86. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/compress.py +0 -0
  87. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/daemon.py +0 -0
  88. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/engine.py +0 -0
  89. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/gateway.py +0 -0
  90. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/gemini_translate.py +0 -0
  91. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/openai_translate.py +0 -0
  92. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/proxy.py +0 -0
  93. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/router/state.py +0 -0
  94. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/scheduling.py +0 -0
  95. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/textual_ui.py +0 -0
  96. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/__init__.py +0 -0
  97. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/interactive.py +0 -0
  98. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/keys.py +0 -0
  99. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/loaders.py +0 -0
  100. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/output.py +0 -0
  101. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/ui/styles.py +0 -0
  102. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/update_checker.py +0 -0
  103. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/__init__.py +0 -0
  104. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/conductor.py +0 -0
  105. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/config.py +0 -0
  106. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/cursor_usage.py +0 -0
  107. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/discovery.py +0 -0
  108. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/manifest.py +0 -0
  109. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/models.py +0 -0
  110. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/pii.py +0 -0
  111. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/runner.py +0 -0
  112. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/secrets.py +0 -0
  113. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/upload/stores.py +0 -0
  114. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli/wrapped_game.py +0 -0
  115. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/SOURCES.txt +0 -0
  116. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/dependency_links.txt +0 -0
  117. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/entry_points.txt +0 -0
  118. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/requires.txt +0 -0
  119. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/entelligence_cli.egg-info/top_level.txt +0 -0
  120. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/setup.cfg +0 -0
  121. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_agent_insights_proxy.py +0 -0
  122. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_agent_insights_proxy_api_client.py +0 -0
  123. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_agent_insights_segment.py +0 -0
  124. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_attach_fix_smoke.py +0 -0
  125. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_attach_ticket_smoke.py +0 -0
  126. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_budget_smoke.py +0 -0
  127. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_capacity_emit.py +0 -0
  128. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_codex_auth.py +0 -0
  129. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_codex_settings.py +0 -0
  130. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_conductor.py +0 -0
  131. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_doctor.py +0 -0
  132. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_path_a_usage.py +0 -0
  133. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_path_regex_and_heartbeat.py +0 -0
  134. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_self_heal_loop.py +0 -0
  135. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_usage.py +0 -0
  136. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_usage_archive.py +0 -0
  137. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_usage_heal.py +0 -0
  138. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_usage_recapture.py +0 -0
  139. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_cursor_usage_state.py +0 -0
  140. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_detached_background_work.py +0 -0
  141. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_diagnostics.py +0 -0
  142. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_discovery_head_unicode.py +0 -0
  143. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_discovery_opencode.py +0 -0
  144. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_error_body_decode.py +0 -0
  145. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_heartbeat_api_client.py +0 -0
  146. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_identity_cache_refresh.py +0 -0
  147. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_incident_refs.py +0 -0
  148. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_incident_smoke.py +0 -0
  149. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_cadence_heartbeat.py +0 -0
  150. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_checkpoint_resume.py +0 -0
  151. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_cursor_composer_home.py +0 -0
  152. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_index_failure.py +0 -0
  153. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_kiro_prompts.py +0 -0
  154. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_log.py +0 -0
  155. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_me_smoke.py +0 -0
  156. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_path_a_default.py +0 -0
  157. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_produced_prs.py +0 -0
  158. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_redrain.py +0 -0
  159. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_repo_attribution.py +0 -0
  160. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_schedule.py +0 -0
  161. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_schedule_arm.py +0 -0
  162. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_insights_structured_payload.py +0 -0
  163. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_legacy_encoding_recovery.py +0 -0
  164. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_mcp_install.py +0 -0
  165. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_multipart_backoff.py +0 -0
  166. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_pii.py +0 -0
  167. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_presigned_skip_index.py +0 -0
  168. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_processing_checkpoint_api_client.py +0 -0
  169. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_reset_command.py +0 -0
  170. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_rosetta_self_heal.py +0 -0
  171. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_router_commands.py +0 -0
  172. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_router_stats.py +0 -0
  173. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_scheduling_cron_env.py +0 -0
  174. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_schtasks_integration.py +0 -0
  175. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_secrets_redaction_boundary.py +0 -0
  176. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_security_commands.py +0 -0
  177. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_segment_chunking.py +0 -0
  178. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_segment_session_timeout.py +0 -0
  179. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_session_brief.py +0 -0
  180. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_sessions_status_chunking.py +0 -0
  181. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_sessions_status_safe_default.py +0 -0
  182. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_skills_command.py +0 -0
  183. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_sync_partial_schema.py +0 -0
  184. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_sync_runs_full_pipeline.py +0 -0
  185. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_update_command.py +0 -0
  186. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_upload_cursor_store.py +0 -0
  187. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_upload_home_backfill.py +0 -0
  188. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_upload_kiro.py +0 -0
  189. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_upload_repo_filter.py +0 -0
  190. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_upload_repo_roots.py +0 -0
  191. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_windows_compat.py +0 -0
  192. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_wrap_retry.py +0 -0
  193. {entelligence_cli-0.1.232 → entelligence_cli-0.1.233}/tests/test_wsl_support.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entelligence-cli
3
- Version: 0.1.232
3
+ Version: 0.1.233
4
4
  Summary: AI-powered code review assistant for your terminal - Get instant, intelligent feedback on your code changes
5
5
  Author-email: EntelligenceAI <info@entelligence.ai>
6
6
  Project-URL: Homepage, https://entelligence.ai
@@ -2040,10 +2040,17 @@ def _sync_cmd(
2040
2040
  # resume_from=None ⇒ no cutoff (from the beginning); a timestamp ⇒ extend the
2041
2041
  # window back to it. An empty result after this flows to the benign "nothing
2042
2042
  # new" branch after the build loop.
2043
+ # The resolved window open, kept for the post-parse guard in the build loop:
2044
+ # discovery's last_span_time is a FILE-MTIME estimate (see _apply_span_metadata's
2045
+ # docstring), and the Cursor composer cache is rewritten fresh every export —
2046
+ # so a conversation from months ago passes this pre-filter looking hours old.
2047
+ # The guard re-checks against the PARSED span times, which are the truth.
2048
+ window_cutoff: datetime | None = None
2043
2049
  if hours:
2044
2050
  cutoff: datetime | None = datetime.now(UTC) - timedelta(hours=hours)
2045
2051
  if pending_generation is not None or pending_client_generation is not None:
2046
2052
  cutoff = None if hwm is None else min(cutoff, hwm)
2053
+ window_cutoff = cutoff
2047
2054
  if cutoff is not None:
2048
2055
  _n_before = len(discovered)
2049
2056
  discovered = [d for d in discovered if d.last_span_time and d.last_span_time >= cutoff]
@@ -2099,6 +2106,7 @@ def _sync_cmd(
2099
2106
  # attribute to their authoring session/model.
2100
2107
  commit_map: dict[str, list[str]] = {}
2101
2108
  max_seen: datetime | None = None
2109
+ outside_window = 0 # parsed-time window guard (ENT-4183); logged after the loop
2102
2110
  # Earliest session that failed to parse this run — the high-water mark must
2103
2111
  # not advance past it, so it stays eligible for a later sync (Path B retries
2104
2112
  # failed extractions via its DLQ; Path A's mark must not strand them).
@@ -2182,6 +2190,33 @@ def _sync_cmd(
2182
2190
  session = build_session_metrics_payload(disc.session_id, spans, repos_by_leaf=repos_by_leaf)
2183
2191
  if session is None:
2184
2192
  continue
2193
+ # Accurate metadata from the parsed spans — set FIRST so every check
2194
+ # below (including the window guard) sees real times, not discovery's
2195
+ # mtime estimates (see this helper's docstring).
2196
+ _apply_span_metadata(session, spans)
2197
+ # Enforce the look-back window on the PARSED session time (ENT-4183):
2198
+ # the pre-filter above ran on discovery's mtime estimate, which the
2199
+ # Cursor composer cache refreshes on every export — without this, a
2200
+ # "last 30 days" run re-ingests conversations from months ago. A
2201
+ # session with no parsed end_time stays (nothing truthful to date it
2202
+ # by), matching the pre-filter's permissiveness for unknown ages.
2203
+ # MUST run before the Cursor usage-state / self-heal accounting below:
2204
+ # skipping AFTER _track_unpriced_cursor has marked the session healed
2205
+ # would silently drop it from the heal set without a push, freezing
2206
+ # its $0 row forever (review finding).
2207
+ _parsed_end = session.get("end_time")
2208
+ if window_cutoff is not None and _parsed_end:
2209
+ with suppress(ValueError, TypeError):
2210
+ _end_dt = datetime.fromisoformat(_parsed_end)
2211
+ if _end_dt.tzinfo is None:
2212
+ # The shared parsers emit UTC; a naive value is UTC without
2213
+ # the marker. Left naive, the aware comparison below raises
2214
+ # TypeError into this suppress and the stale session slips
2215
+ # through open (review finding) — normalize instead.
2216
+ _end_dt = _end_dt.replace(tzinfo=UTC)
2217
+ if _end_dt < window_cutoff:
2218
+ outside_window += 1
2219
+ continue
2185
2220
  # WHY this Cursor session has (or lacks) billed usage rides the wire, so
2186
2221
  # the dashboard can say "sign in to Cursor" / "upgrade the CLI" instead
2187
2222
  # of a bare $0 that reads as "cost nothing" (None for non-Cursor).
@@ -2208,24 +2243,6 @@ def _sync_cmd(
2208
2243
  # server-side or backfilled by the detached LLM task push.
2209
2244
  agent = disc.session_id.split(":")[1] if ":" in disc.session_id else "unknown"
2210
2245
  session["agent"] = agent
2211
- # ENT-4131 M1 dual-write: additive, alongside the structured payload
2212
- # below — never lets a build failure affect the existing push.
2213
- with suppress(Exception):
2214
- envelope = facts_envelope.build_envelope(
2215
- session_id=disc.session_id,
2216
- org_uuid=org_uuid,
2217
- agent=agent,
2218
- spans=spans,
2219
- client_version=_client_version(),
2220
- cursor_usage=cursor_billed_usage,
2221
- )
2222
- if envelope is not None:
2223
- envelopes.append(envelope)
2224
- # Accurate metadata from the parsed spans (Path B derives these
2225
- # server-side the same way) — NOT DiscoveredSession's discovery estimates,
2226
- # which set span_count to file_size//500 and both timestamps to the file
2227
- # mtime (identical start/end → zero-duration, wrong time-based views).
2228
- _apply_span_metadata(session, spans)
2229
2246
  branch = source.get_branch(disc.session_id)
2230
2247
  if branch:
2231
2248
  session["branch"] = branch
@@ -2261,6 +2278,23 @@ def _sync_cmd(
2261
2278
  # it from path NAMES was tried and reverted (a guess dressed as a
2262
2279
  # tier); the honest fix is to remember each root→remote fact while
2263
2280
  # git can still prove it, which is its own change.
2281
+ # ENT-4131 M1 dual-write: additive, alongside the structured payload
2282
+ # below — never lets a build failure affect the existing push. Built
2283
+ # AFTER the attribution tiers above so the v2 envelope's repo_remote
2284
+ # env fact (ENT-4180) carries the same resolved value the structured
2285
+ # payload ships.
2286
+ with suppress(Exception):
2287
+ envelope = facts_envelope.build_envelope(
2288
+ session_id=disc.session_id,
2289
+ org_uuid=org_uuid,
2290
+ agent=agent,
2291
+ spans=spans,
2292
+ client_version=_client_version(),
2293
+ cursor_usage=cursor_billed_usage,
2294
+ repo_remote=session.get("repo_remote"),
2295
+ )
2296
+ if envelope is not None:
2297
+ envelopes.append(envelope)
2264
2298
  shas = _session_commits_from_spans(spans)
2265
2299
  if shas:
2266
2300
  commit_map[disc.session_id] = shas
@@ -2276,6 +2310,12 @@ def _sync_cmd(
2276
2310
  if last and (max_seen is None or last > max_seen):
2277
2311
  max_seen = last
2278
2312
 
2313
+ if outside_window:
2314
+ runlog.line(
2315
+ "build",
2316
+ f"{outside_window} session(s) outside the look-back window by parsed "
2317
+ "span time (discovery mtime said newer) — not pushed",
2318
+ )
2279
2319
  if cursor_usage_run_state != RUN_STATE_NO_CURSOR_SESSIONS:
2280
2320
  # Remembered for the hourly heartbeat: the run-level reason plus the
2281
2321
  # per-session tally, so the org's readiness check can name the machines
@@ -4910,11 +4950,21 @@ def _run_memcore_analyze_and_push(api_client, org_uuid: str | None, *, force: bo
4910
4950
  # structured-ingest push below, regardless of whether envelope-building
4911
4951
  # succeeds.
4912
4952
  envelopes: list[dict] = []
4953
+ _envelope_repo_cache: dict[str, str | None] = {}
4913
4954
  for _payload in session_payloads:
4914
4955
  _spans = _payload.pop("_dual_write_spans", None)
4915
4956
  if _spans is None:
4916
4957
  continue
4917
4958
  with suppress(Exception):
4959
+ # build_session_metrics_payload emits `repo_name` (the resolved
4960
+ # display name), never the raw remote — resolve the remote here
4961
+ # from the session's touched files, the same tier the foreground
4962
+ # sync's attribution uses, so the segmented-lane v2 envelope
4963
+ # carries the same env fact the foreground one does.
4964
+ _remote = _payload.get("repo_remote")
4965
+ if not _remote:
4966
+ with suppress(Exception):
4967
+ _remote = _task_repo_remote(_files_from_spans(_spans), _envelope_repo_cache)
4918
4968
  envelope = facts_envelope.build_envelope(
4919
4969
  session_id=_payload.get("session_id", ""),
4920
4970
  org_uuid=org_uuid,
@@ -4923,6 +4973,7 @@ def _run_memcore_analyze_and_push(api_client, org_uuid: str | None, *, force: bo
4923
4973
  client_version=_client_version(),
4924
4974
  tasks=_payload.get("tasks"),
4925
4975
  cursor_usage=cursor_billed_usage,
4976
+ repo_remote=_remote,
4926
4977
  )
4927
4978
  if envelope is not None:
4928
4979
  envelopes.append(envelope)
@@ -33,6 +33,7 @@ from __future__ import annotations
33
33
  import hashlib
34
34
  import json
35
35
  import logging
36
+ import re
36
37
  import uuid
37
38
  from contextlib import suppress
38
39
  from datetime import UTC, datetime
@@ -48,7 +49,16 @@ logger = logging.getLogger(__name__)
48
49
  # Bumped by hand together with the backend's own copy whenever the envelope
49
50
  # shape changes in ANY way (additionalProperties: false means every change
50
51
  # is a version bump — see facts_envelope_contract.py's docstring).
51
- ENVELOPE_SCHEMA_VERSION = "1"
52
+ # v2 (ENT-4180): skills_used records, per-turn prompt_tokens +
53
+ # cache_write_1h_tokens, per-tool-call mcp_server / input_digest /
54
+ # file_paths, env_facts repo_remote + interrupt_count — the facts that
55
+ # make skill/interrupt/retry/files-per-task/1h-cache/compaction/repo
56
+ # conclusions server-recomputable instead of client-push-only.
57
+ ENVELOPE_SCHEMA_VERSION = "2"
58
+
59
+ # file_paths per tool call is capped to match the backend schema's maxItems —
60
+ # a single Bash call fanning out over a huge tree must not bloat the envelope.
61
+ _MAX_FILE_PATHS_PER_CALL = 50
52
62
 
53
63
  # No independent versioning exists yet for the vendored memory_core parser
54
64
  # (it ships atomically with the CLI release) or for each local store's file
@@ -148,11 +158,50 @@ def _build_turns(spans: list[SpanData]) -> list[dict[str, Any]]:
148
158
  "cache_write_tokens": int(s.attributes.get("llm.token_count.cache_write") or 0),
149
159
  "cache_read_tokens": int(s.attributes.get("llm.token_count.cache_read") or 0),
150
160
  "output_tokens": int(s.attributes.get("llm.token_count.completion") or 0),
161
+ # v2 (ENT-4180): the parsed value itself, not a reconstruction
162
+ # — exact compaction/floor-drift parity reads this. Read the
163
+ # attribute directly (same idiom as every field above): the
164
+ # SpanData.prompt_tokens property does int(attr, default 0),
165
+ # which raises TypeError on a present-but-None value — and the
166
+ # callers suppress build failures, so that crash would
167
+ # silently drop the whole envelope for the session.
168
+ "prompt_tokens": int(s.attributes.get("llm.token_count.prompt") or 0),
169
+ "cache_write_1h_tokens": int(
170
+ s.attributes.get("llm.token_count.cache_write_1h") or 0
171
+ ),
151
172
  }
152
173
  )
153
174
  return turns
154
175
 
155
176
 
177
+ # The same key extraction extract_files_per_task uses (segment_pure.py) — one
178
+ # regex, so the envelope's file facts and today's tasks_json.files can never
179
+ # disagree about what counts as a touched file.
180
+ _FILE_PATH_RE = re.compile(r'"(?:file_path|notebook_path)":\s*"([^"]+)"')
181
+
182
+
183
+ def _mcp_server(tool_name: str) -> str | None:
184
+ """The server segment of an ``mcp__<server>__<tool>`` name; None otherwise."""
185
+ if not tool_name.startswith("mcp__"):
186
+ return None
187
+ rest = tool_name[len("mcp__") :]
188
+ server, sep, _tool = rest.partition("__")
189
+ return (server[:128] or None) if sep else None
190
+
191
+
192
+ def _input_digest(input_value: str) -> str | None:
193
+ """16-hex truncated SHA-256 of the call's input, or None when there is none.
194
+
195
+ The digest exists so error_retry_sequences' "same operation re-attempted"
196
+ detection can replay server-side WITHOUT the input ever leaving the
197
+ machine — equal inputs hash equal, and 16 hex chars are useless for
198
+ reconstruction.
199
+ """
200
+ if not input_value:
201
+ return None
202
+ return hashlib.sha256(input_value.encode("utf-8", "replace")).hexdigest()[:16]
203
+
204
+
156
205
  def _build_tool_calls(spans: list[SpanData]) -> list[dict[str, Any]]:
157
206
  turn_ids = {s.span_id for s in spans if s.name.startswith("Turn ")}
158
207
  tool_calls = []
@@ -160,17 +209,51 @@ def _build_tool_calls(spans: list[SpanData]) -> list[dict[str, Any]]:
160
209
  if s.name.startswith("Turn ") or s.parent_id not in turn_ids:
161
210
  continue
162
211
  status = {"OK": "success", "ERROR": "error"}.get(s.status_code, "unknown")
212
+ tool_name = s.attributes.get("tool.name") or s.name or "unknown"
213
+ input_value = s.attributes.get("input.value", "")
214
+ if not isinstance(input_value, str):
215
+ input_value = ""
216
+ # Extracted PATHS only, never the input itself — the schema caps the
217
+ # list and the paths are the same values tasks_json.files ships today.
218
+ file_paths = _FILE_PATH_RE.findall(input_value)[:_MAX_FILE_PATHS_PER_CALL]
163
219
  tool_calls.append(
164
220
  {
165
221
  "turn_id": s.parent_id,
166
- "tool_name": s.attributes.get("tool.name") or s.name or "unknown",
222
+ "tool_name": tool_name,
167
223
  "status": status,
168
224
  "started_at": _iso(s.start_time),
225
+ "mcp_server": _mcp_server(tool_name),
226
+ "input_digest": _input_digest(input_value),
227
+ "file_paths": [p[:512] for p in file_paths],
169
228
  }
170
229
  )
171
230
  return tool_calls
172
231
 
173
232
 
233
+ def _build_skills_used(spans: list[SpanData]) -> list[dict[str, Any]]:
234
+ """Session skills-used facts — NORMALIZED names + counts, never raw paths.
235
+
236
+ Reuses the exact computation `skill_distribution` (the client-pushed
237
+ conclusion) runs, so the fact and the conclusion can never disagree —
238
+ which is precisely what lets the server recompute the conclusion later.
239
+ """
240
+ from entelligence_cli import _vendor # noqa: F401 — vendored memory_core on sys.path
241
+ from memory_core.ingestion.coding_agent.session_pure import skill_distribution
242
+
243
+ return [
244
+ {"name": name[:128], "count": count}
245
+ for name, count in sorted(skill_distribution(spans).items())
246
+ ]
247
+
248
+
249
+ def _interrupt_count(spans: list[SpanData]) -> int | None:
250
+ """The harness-reported interrupt total; None = never reported (NOT zero)."""
251
+ from entelligence_cli import _vendor # noqa: F401 — vendored memory_core on sys.path
252
+ from memory_core.ingestion.coding_agent.session_pure import interrupt_count_measured
253
+
254
+ return interrupt_count_measured(spans)
255
+
256
+
174
257
  def _build_segments(
175
258
  tasks: list[dict[str, Any]] | None, spans: list[SpanData]
176
259
  ) -> list[dict[str, Any]]:
@@ -250,11 +333,15 @@ def build_envelope(
250
333
  client_version: str | None,
251
334
  tasks: list[dict[str, Any]] | None = None,
252
335
  cursor_usage: dict[str, dict] | None = None,
336
+ repo_remote: str | None = None,
253
337
  ) -> dict[str, Any] | None:
254
338
  """Build one facts envelope for a session, or None if it has no turns.
255
339
 
256
340
  `agent` must be `"claude-code"` or `"cursor"` (the two the schema
257
341
  enums) — any other locally-detected agent has no envelope yet.
342
+ `repo_remote` is the caller's already-resolved normalized git remote for
343
+ the session (the same value the structured push stores) — passed in
344
+ rather than resolved here so this builder never runs git itself.
258
345
  """
259
346
  if agent not in ("claude-code", "cursor"):
260
347
  return None
@@ -262,21 +349,28 @@ def build_envelope(
262
349
  if not turns:
263
350
  return None
264
351
 
352
+ env_facts: dict[str, Any] = {
353
+ "cli_version": client_version or "unknown",
354
+ "parser_version": _PARSER_VERSION,
355
+ "schema_version": _STORE_SCHEMA_VERSION_BY_AGENT.get(agent, "unknown"),
356
+ "machine_id": _machine_id(),
357
+ # v2 (ENT-4180): both nullable — null keeps the "uninstrumented is
358
+ # not zero" distinction the RDS instrumentation gate relies on.
359
+ "repo_remote": (repo_remote or None) and str(repo_remote)[:512],
360
+ "interrupt_count": _interrupt_count(spans),
361
+ }
362
+
265
363
  envelope: dict[str, Any] = {
266
364
  "envelope_version": ENVELOPE_SCHEMA_VERSION,
267
365
  "org_uuid": org_uuid,
268
366
  "session_id": session_id,
269
367
  "agent": agent,
270
368
  "generated_at": datetime.now(UTC).isoformat(),
271
- "env_facts": {
272
- "cli_version": client_version or "unknown",
273
- "parser_version": _PARSER_VERSION,
274
- "schema_version": _STORE_SCHEMA_VERSION_BY_AGENT.get(agent, "unknown"),
275
- "machine_id": _machine_id(),
276
- },
369
+ "env_facts": env_facts,
277
370
  "turns": turns,
278
371
  "tool_calls": _build_tool_calls(spans),
279
372
  "segments": _build_segments(tasks, spans),
373
+ "skills_used": _build_skills_used(spans),
280
374
  }
281
375
  if agent == "cursor":
282
376
  envelope["cursor_usage_rows"] = _build_cursor_usage_rows(session_id, cursor_usage)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entelligence-cli
3
- Version: 0.1.232
3
+ Version: 0.1.233
4
4
  Summary: AI-powered code review assistant for your terminal - Get instant, intelligent feedback on your code changes
5
5
  Author-email: EntelligenceAI <info@entelligence.ai>
6
6
  Project-URL: Homepage, https://entelligence.ai
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "entelligence-cli"
7
- version = "0.1.232"
7
+ version = "0.1.233"
8
8
  description = "AI-powered code review assistant for your terminal - Get instant, intelligent feedback on your code changes"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -109,6 +109,11 @@ class TestBuildToolCalls:
109
109
  "tool_name": "Edit",
110
110
  "status": "success",
111
111
  "started_at": "2026-01-01T00:00:00+00:00",
112
+ # v2 (ENT-4180): no input on this span → no digest/paths; a
113
+ # non-MCP tool has no server.
114
+ "mcp_server": None,
115
+ "input_digest": None,
116
+ "file_paths": [],
112
117
  }
113
118
 
114
119
  def test_status_mapping(self):
@@ -400,3 +405,161 @@ class TestPushEnvelopes:
400
405
  sent = facts_envelope.push_envelopes(FakeClient(), "org1", [{"session_id": "s1"}])
401
406
  assert len(calls) == 1
402
407
  assert sent == 0
408
+
409
+
410
+ class TestEnvelopeV2Facts:
411
+ """ENT-4180 — the v2 additions that make skill/interrupt/retry/files/
412
+ 1h-cache/compaction/repo conclusions server-recomputable."""
413
+
414
+ def test_turns_carry_prompt_and_1h_cache_tokens(self):
415
+ spans = [
416
+ _turn_span(
417
+ 1,
418
+ attrs={
419
+ "llm.token_count.prompt": 4200,
420
+ "llm.token_count.cache_write_1h": 88,
421
+ },
422
+ )
423
+ ]
424
+ (t,) = facts_envelope._build_turns(spans)
425
+ assert t["prompt_tokens"] == 4200
426
+ assert t["cache_write_1h_tokens"] == 88
427
+
428
+ def test_mcp_server_is_parsed_from_the_tool_name(self):
429
+ assert facts_envelope._mcp_server("mcp__linear__save_issue") == "linear"
430
+ assert facts_envelope._mcp_server("mcp__claude-in-chrome__navigate") == "claude-in-chrome"
431
+ assert facts_envelope._mcp_server("Read") is None
432
+ assert facts_envelope._mcp_server("mcp__noseparator") is None
433
+
434
+ def test_input_digest_is_16_hex_and_input_never_ships(self):
435
+ spans = [
436
+ _turn_span(1),
437
+ _span(
438
+ "tr1:tool:a",
439
+ name="Bash",
440
+ parent="tr1:turn:1",
441
+ attrs={"tool.name": "Bash", "input.value": '{"command": "make deploy"}'},
442
+ ),
443
+ ]
444
+ (call,) = facts_envelope._build_tool_calls(spans)
445
+ # The SPECIFIED algorithm, not just "some deterministic 16-hex value" —
446
+ # server-side retry detection re-derives nothing, so client and any
447
+ # future comparer must agree on sha256[:16] exactly.
448
+ import hashlib
449
+
450
+ expected = hashlib.sha256(b'{"command": "make deploy"}').hexdigest()[:16]
451
+ assert call["input_digest"] == expected
452
+ # A different input changes the digest (the retry-detection property).
453
+ other = [
454
+ spans[0],
455
+ _span(
456
+ "tr1:tool:b",
457
+ name="Bash",
458
+ parent="tr1:turn:1",
459
+ attrs={"tool.name": "Bash", "input.value": '{"command": "make test"}'},
460
+ ),
461
+ ]
462
+ (other_call,) = facts_envelope._build_tool_calls(other)
463
+ assert other_call["input_digest"] != call["input_digest"]
464
+ # ...and the raw input appears nowhere in the record.
465
+ assert "make deploy" not in json.dumps(call)
466
+
467
+ def test_file_paths_are_extracted_capped_and_nothing_else(self):
468
+ inp = json.dumps({"file_path": "src/a.py", "old_string": "SECRET CONTENT"})
469
+ spans = [
470
+ _turn_span(1),
471
+ _span(
472
+ "tr1:tool:a",
473
+ name="Edit",
474
+ parent="tr1:turn:1",
475
+ attrs={"tool.name": "Edit", "input.value": inp},
476
+ ),
477
+ ]
478
+ (call,) = facts_envelope._build_tool_calls(spans)
479
+ assert call["file_paths"] == ["src/a.py"]
480
+ assert "SECRET CONTENT" not in json.dumps(call)
481
+
482
+ def test_file_paths_cap(self):
483
+ many = "".join(f'"file_path": "f{i}.py", ' for i in range(80))
484
+ spans = [
485
+ _turn_span(1),
486
+ _span(
487
+ "tr1:tool:a",
488
+ name="Bash",
489
+ parent="tr1:turn:1",
490
+ attrs={"tool.name": "Bash", "input.value": "{" + many + "}"},
491
+ ),
492
+ ]
493
+ (call,) = facts_envelope._build_tool_calls(spans)
494
+ # The CONTRACT's cap (backend schema maxItems: 50) — a drifted
495
+ # implementation constant must fail here, not silently follow along.
496
+ assert len(call["file_paths"]) == 50
497
+
498
+ def test_skills_used_are_normalized_names_with_counts(self):
499
+ signals = json.dumps(
500
+ {
501
+ "skills_used": [
502
+ {"path": "/Users/x/.claude/skills/deploy-and-verify/SKILL.md", "count": 2},
503
+ ]
504
+ }
505
+ )
506
+ spans = [
507
+ _span("tr1:root", name="Session", attrs={"harness.session_signals": signals}),
508
+ _turn_span(1, parent="tr1:root"),
509
+ ]
510
+ skills = facts_envelope._build_skills_used(spans)
511
+ assert skills == [{"name": "deploy-and-verify", "count": 2}]
512
+ # The raw path never rides along — normalized name only.
513
+ assert "/Users/" not in json.dumps(skills)
514
+
515
+ def test_envelope_is_version_2_with_skills_and_env_facts(self, tmp_path, monkeypatch):
516
+ monkeypatch.setattr(facts_envelope.Path, "home", classmethod(lambda cls: tmp_path))
517
+ signals = json.dumps(
518
+ {
519
+ "skills_used": [{"path": "graphify/SKILL.md", "count": 1}],
520
+ # The parser's real shape: a dict with "total" — a bare scalar
521
+ # is ignored (review finding: the old fixture used 3 and the
522
+ # test never noticed interrupt_count staying null).
523
+ "interrupts": {"total": 3},
524
+ }
525
+ )
526
+ spans = [
527
+ _span("tr1:root", name="Session", attrs={"harness.session_signals": signals}),
528
+ _turn_span(1, parent="tr1:root"),
529
+ ]
530
+ envelope = facts_envelope.build_envelope(
531
+ session_id="local:claude-code:s1",
532
+ org_uuid="org-1",
533
+ agent="claude-code",
534
+ spans=spans,
535
+ client_version="0.1.232",
536
+ repo_remote="github.com/acme/api",
537
+ )
538
+ assert envelope["envelope_version"] == "2"
539
+ assert envelope["skills_used"] == [{"name": "graphify", "count": 1}]
540
+ assert envelope["env_facts"]["repo_remote"] == "github.com/acme/api"
541
+ assert envelope["env_facts"]["interrupt_count"] == 3
542
+
543
+ def test_missing_signals_yield_empty_skills_and_null_interrupts(self, tmp_path, monkeypatch):
544
+ # Uninstrumented is NOT zero — the envelope must preserve the
545
+ # distinction the RDS instrumentation gate relies on.
546
+ monkeypatch.setattr(facts_envelope.Path, "home", classmethod(lambda cls: tmp_path))
547
+ envelope = facts_envelope.build_envelope(
548
+ session_id="local:claude-code:s1",
549
+ org_uuid="org-1",
550
+ agent="claude-code",
551
+ spans=[_turn_span(1)],
552
+ client_version="0.1.232",
553
+ )
554
+ assert envelope["skills_used"] == []
555
+ assert envelope["env_facts"]["interrupt_count"] is None
556
+ assert envelope["env_facts"]["repo_remote"] is None
557
+
558
+ def test_present_but_null_prompt_token_attr_does_not_crash(self):
559
+ # Review finding (MAJOR): SpanData.prompt_tokens does int(attr) and
560
+ # raises TypeError on a present-but-None value; since callers suppress
561
+ # build failures, the whole envelope silently vanished for the
562
+ # session. The builder must read the attribute null-safely.
563
+ spans = [_turn_span(1, attrs={"llm.token_count.prompt": None})]
564
+ (t,) = facts_envelope._build_turns(spans)
565
+ assert t["prompt_tokens"] == 0
@@ -34,7 +34,7 @@ NOW = datetime.now(UTC)
34
34
  RECENT = NOW - timedelta(hours=3)
35
35
 
36
36
 
37
- def _spans(sid: str) -> list[SpanData]:
37
+ def _spans(sid: str, when: datetime = RECENT) -> list[SpanData]:
38
38
  """A minimal Claude Code session: root + one turn with real token counts."""
39
39
  root_id = f"{sid}:root"
40
40
  root = SpanData(
@@ -44,8 +44,8 @@ def _spans(sid: str) -> list[SpanData]:
44
44
  name="Session",
45
45
  span_kind="CHAIN",
46
46
  status_code="OK",
47
- start_time=RECENT,
48
- end_time=RECENT + timedelta(minutes=5),
47
+ start_time=when,
48
+ end_time=when + timedelta(minutes=5),
49
49
  attributes={
50
50
  "session.id": sid,
51
51
  "harness.agent": "claude-code",
@@ -61,8 +61,8 @@ def _spans(sid: str) -> list[SpanData]:
61
61
  name="Turn 1",
62
62
  span_kind="CHAIN",
63
63
  status_code="OK",
64
- start_time=RECENT,
65
- end_time=RECENT + timedelta(minutes=5),
64
+ start_time=when,
65
+ end_time=when + timedelta(minutes=5),
66
66
  attributes={
67
67
  "input.value": "fix the flaky test",
68
68
  "output.value": "done",
@@ -75,9 +75,12 @@ def _spans(sid: str) -> list[SpanData]:
75
75
 
76
76
 
77
77
  class _Source:
78
- def __init__(self, ids, last=RECENT):
78
+ def __init__(self, ids, last=RECENT, span_time=None):
79
79
  self._ids = list(ids)
80
80
  self._last = last
81
+ # Per-session PARSED span age — lets a test model the composer-cache
82
+ # shape where discovery mtime says "fresh" but the content is months old.
83
+ self._span_time = span_time or {}
81
84
 
82
85
  def discover_sessions(self):
83
86
  return [
@@ -88,7 +91,8 @@ class _Source:
88
91
  ]
89
92
 
90
93
  def get_spans_by_session(self, sid):
91
- return _spans(sid.rsplit(":", 1)[-1])
94
+ short = sid.rsplit(":", 1)[-1]
95
+ return _spans(short, when=self._span_time.get(short, RECENT))
92
96
 
93
97
  def get_branch(self, sid):
94
98
  return None
@@ -107,9 +111,9 @@ def harness(tmp_path, monkeypatch):
107
111
  monkeypatch.setattr(
108
112
  "entelligence_cli.upload.cursor_usage.fetch_cursor_usage", lambda start, end, **kw: {}
109
113
  )
110
- state = {"source": _Source(["s1"]), "hwm": None}
114
+ state = {"source": _Source(["s1"]), "hwm": None, "gen": None}
111
115
  monkeypatch.setattr(
112
- ins, "_resolve_high_water_mark", lambda api, org: (state["hwm"], None, None, None)
116
+ ins, "_resolve_high_water_mark", lambda api, org: (state["hwm"], state["gen"], None, None)
113
117
  )
114
118
  fake_factory = types.ModuleType("memory_core.ingestion.coding_agent._sources.factory")
115
119
  fake_factory.get_source = lambda *a, **k: state["source"]
@@ -157,3 +161,61 @@ def test_a_session_ahead_of_the_watermark_is_pushed(harness):
157
161
  harness.state["hwm"] = RECENT - timedelta(hours=1)
158
162
  harness.run()
159
163
  assert [s["session_id"] for s in harness.pushed()] == ["local:claude-code:s1"]
164
+
165
+
166
+ def test_stale_content_behind_a_fresh_mtime_is_not_pushed(harness):
167
+ # ENT-4183: the Cursor composer cache is rewritten on every export, so
168
+ # discovery's mtime-derived last_span_time reads "hours old" for a
169
+ # conversation whose PARSED spans are months old. The pre-filter passes it;
170
+ # the post-parse guard must drop it — without this, a "last 30 days" run
171
+ # re-ingests the whole cached history.
172
+ harness.state["source"] = _Source(
173
+ ["fresh", "stale"], span_time={"stale": NOW - timedelta(days=200)}
174
+ )
175
+ harness.run()
176
+ assert [s["session_id"] for s in harness.pushed()] == ["local:claude-code:fresh"]
177
+
178
+
179
+ def test_directive_with_no_resume_from_readmits_old_content(harness):
180
+ # resume_from=None ("from the beginning") removes the window entirely —
181
+ # the guard must honor that, or a data-reset directive could never
182
+ # re-ingest history older than the default look-back.
183
+ harness.state["source"] = _Source(["old"], span_time={"old": NOW - timedelta(days=200)})
184
+ harness.state["gen"] = 7 # pending directive, hwm None => window removed
185
+ harness.run()
186
+ assert [s["session_id"] for s in harness.pushed()] == ["local:claude-code:old"]
187
+
188
+
189
+ def test_naive_timestamped_stale_content_is_still_filtered(harness):
190
+ # The shared parsers can emit timezone-less datetimes; the guard must
191
+ # normalize them (assume UTC) rather than let the aware-vs-naive
192
+ # TypeError fall into its suppress and fail open (review finding).
193
+ naive_old = (NOW - timedelta(days=200)).replace(tzinfo=None)
194
+ harness.state["source"] = _Source(["fresh", "naivestale"], span_time={"naivestale": naive_old})
195
+ harness.run()
196
+ assert [s["session_id"] for s in harness.pushed()] == ["local:claude-code:fresh"]
197
+
198
+
199
+ def test_window_skipped_session_never_touches_cursor_heal_accounting(harness, monkeypatch):
200
+ # Review CRITICAL (cli#272): the parsed-time guard must run BEFORE the
201
+ # Cursor usage-state / self-heal accounting. If _track_unpriced_cursor has
202
+ # already marked a session healed when the guard then skips its push, the
203
+ # session silently leaves the heal set without ever being pushed priced —
204
+ # its $0 row can never heal on a normal future sync.
205
+ tracked = []
206
+ monkeypatch.setattr(ins, "_track_unpriced_cursor", lambda s, sid, state: tracked.append(sid))
207
+ # Patched at its SOURCE module — the sync loop imports it locally, so an
208
+ # attribute on `ins` would never be seen and the test would pass vacuously.
209
+ monkeypatch.setattr(
210
+ "entelligence_cli.cursor_path_a_usage.cursor_usage_state_for",
211
+ lambda *a, **k: "ok",
212
+ )
213
+ harness.state["source"] = _Source(
214
+ ["fresh", "stale"], span_time={"stale": NOW - timedelta(days=200)}
215
+ )
216
+ harness.run()
217
+ assert [s["session_id"] for s in harness.pushed()] == ["local:claude-code:fresh"]
218
+ # The pushed session WAS tracked (proves the spy is live, not vacuous)...
219
+ assert any("fresh" in sid for sid in tracked)
220
+ # ...and the window-skipped one never reached the heal accounting.
221
+ assert all("stale" not in sid for sid in tracked)