graphite-code 1.4.0__tar.gz → 1.5.0__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 (320) hide show
  1. {graphite_code-1.4.0 → graphite_code-1.5.0}/CHANGELOG.md +165 -3
  2. {graphite_code-1.4.0 → graphite_code-1.5.0}/PKG-INFO +2 -2
  3. {graphite_code-1.4.0 → graphite_code-1.5.0}/README.md +1 -1
  4. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/__init__.py +1 -1
  5. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/agent_hooks.py +64 -5
  6. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/extract/ast.py +153 -10
  7. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/resolve.py +19 -11
  8. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/usage_ledger.py +27 -0
  9. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/conftest.py +17 -1
  10. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_agent_hooks.py +15 -0
  11. graphite_code-1.5.0/tests/test_agent_hooks_session_books.py +145 -0
  12. graphite_code-1.5.0/tests/test_agent_hooks_session_tagging.py +172 -0
  13. graphite_code-1.5.0/tests/test_ast_name_a_module_only_imports.py +274 -0
  14. graphite_code-1.5.0/tests/test_ast_super_over_a_builtin_base.py +277 -0
  15. graphite_code-1.5.0/tests/test_resolve_python_reexports_of.py +58 -0
  16. {graphite_code-1.4.0 → graphite_code-1.5.0}/.gitignore +0 -0
  17. {graphite_code-1.4.0 → graphite_code-1.5.0}/ARCHITECTURE.md +0 -0
  18. {graphite_code-1.4.0 → graphite_code-1.5.0}/CONTRIBUTING.md +0 -0
  19. {graphite_code-1.4.0 → graphite_code-1.5.0}/LICENSE +0 -0
  20. {graphite_code-1.4.0 → graphite_code-1.5.0}/RELEASING.md +0 -0
  21. {graphite_code-1.4.0 → graphite_code-1.5.0}/pyproject.toml +0 -0
  22. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/__main__.py +0 -0
  23. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/_cleanup_worker.py +0 -0
  24. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/_win32_ctypes.py +0 -0
  25. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/activation.py +0 -0
  26. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/agent_settings.py +0 -0
  27. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/analyze.py +0 -0
  28. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/answer_contract.py +0 -0
  29. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/bootstrap.py +0 -0
  30. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/buildlock.py +0 -0
  31. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/cache.py +0 -0
  32. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/channel.py +0 -0
  33. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/cli.py +0 -0
  34. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/cluster.py +0 -0
  35. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/config.py +0 -0
  36. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/context.py +0 -0
  37. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/daemon.py +0 -0
  38. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/daemon_health.py +0 -0
  39. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/daemon_launch.py +0 -0
  40. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/debt.py +0 -0
  41. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/dependency_install.py +0 -0
  42. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/detach.py +0 -0
  43. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/doctor.py +0 -0
  44. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/doctor_probes.py +0 -0
  45. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/engine_identity.py +0 -0
  46. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/export/__init__.py +0 -0
  47. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/export/html.py +0 -0
  48. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/export/json.py +0 -0
  49. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/export/md.py +0 -0
  50. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/extract/__init__.py +0 -0
  51. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/extract/pyscope.py +0 -0
  52. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/freshness.py +0 -0
  53. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/git.py +0 -0
  54. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/graph.py +0 -0
  55. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/graph_io.py +0 -0
  56. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/health.py +0 -0
  57. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/hook_entry.py +0 -0
  58. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/hookinstall.py +0 -0
  59. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/hookshim.py +0 -0
  60. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/incident_ledger.py +0 -0
  61. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/ingest.py +0 -0
  62. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/init.py +0 -0
  63. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/io.py +0 -0
  64. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/launchd_agent.py +0 -0
  65. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/listing.py +0 -0
  66. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/llm.py +0 -0
  67. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/llm_probe.py +0 -0
  68. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/mcp.py +0 -0
  69. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/mcp_server.py +0 -0
  70. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/natural_query.py +0 -0
  71. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/overlays.py +0 -0
  72. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/ownership.py +0 -0
  73. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/probe_process.py +0 -0
  74. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/probe_workspace.py +0 -0
  75. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/process_contracts.py +0 -0
  76. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/programs.py +0 -0
  77. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/provider_observer.py +0 -0
  78. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/py.typed +0 -0
  79. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/query.py +0 -0
  80. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/query_plan.py +0 -0
  81. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/replacement_audit.py +0 -0
  82. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/review.py +0 -0
  83. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/__init__.py +0 -0
  84. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/approval.py +0 -0
  85. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/classifier.py +0 -0
  86. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/claude_executor.py +0 -0
  87. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/claude_probe.py +0 -0
  88. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/cli_identity.py +0 -0
  89. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/codex_executor.py +0 -0
  90. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/codex_probe.py +0 -0
  91. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/context_builder.py +0 -0
  92. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/contracts.py +0 -0
  93. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/diff_policy.py +0 -0
  94. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/edit_apply.py +0 -0
  95. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/effort.py +0 -0
  96. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/lifecycle.py +0 -0
  97. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_operator.py +0 -0
  98. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_service.py +0 -0
  99. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_storage.py +0 -0
  100. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/ollama_executor.py +0 -0
  101. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/ollama_probe.py +0 -0
  102. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/openrouter_executor.py +0 -0
  103. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/openrouter_probe.py +0 -0
  104. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/policy.py +0 -0
  105. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/probe_runner.py +0 -0
  106. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/process_runner.py +0 -0
  107. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/profiles.py +0 -0
  108. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/prompt.py +0 -0
  109. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/registry.py +0 -0
  110. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/route_pool.py +0 -0
  111. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/route_pool_execution.py +0 -0
  112. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/schema_validation.py +0 -0
  113. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/service.py +0 -0
  114. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/settings.py +0 -0
  115. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/shadow.py +0 -0
  116. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/storage.py +0 -0
  117. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/telemetry.py +0 -0
  118. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/worktree.py +0 -0
  119. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/zai_edit.py +0 -0
  120. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/zai_executor.py +0 -0
  121. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/routing/zai_probe.py +0 -0
  122. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/savings.py +0 -0
  123. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/systemd_unit.py +0 -0
  124. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/ts_bridge.py +0 -0
  125. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/ts_resolver.mjs +0 -0
  126. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/typescript_activation.py +0 -0
  127. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/validation.py +0 -0
  128. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/watch.py +0 -0
  129. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/windows_job.py +0 -0
  130. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/windows_startup.py +0 -0
  131. {graphite_code-1.4.0 → graphite_code-1.5.0}/src/graphite/windows_task.py +0 -0
  132. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/data/sqloracle/blindspots.py.txt +0 -0
  133. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/data/sqloracle/round69.py.txt +0 -0
  134. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/fake_clis/fake_cli.py +0 -0
  135. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/fixtures/provider_lifecycle_schema_v1.sql +0 -0
  136. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v2_ca77600.sql +0 -0
  137. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v3_94eb333.sql +0 -0
  138. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v4_lifecycle_migration.sql +0 -0
  139. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test__win32_ctypes.py +0 -0
  140. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_activation.py +0 -0
  141. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_activation_backstop.py +0 -0
  142. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_agent_hook_activation.py +0 -0
  143. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_agent_settings.py +0 -0
  144. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_answer_contract.py +0 -0
  145. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_arrow_and_constructor_binding.py +0 -0
  146. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_ast_make_id_length.py +0 -0
  147. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_ast_source_lines.py +0 -0
  148. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_atomic_write.py +0 -0
  149. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_bootstrap.py +0 -0
  150. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_build_detach.py +0 -0
  151. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_buildlock.py +0 -0
  152. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cache_engine_identity.py +0 -0
  153. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cache_entry_pruning.py +0 -0
  154. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cache_file_identity.py +0 -0
  155. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cache_file_set.py +0 -0
  156. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cache_pruning.py +0 -0
  157. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_call_graph.py +0 -0
  158. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_case_ambiguous_answer.py +0 -0
  159. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_attribution.py +0 -0
  160. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_cli.py +0 -0
  161. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_core.py +0 -0
  162. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_kind.py +0 -0
  163. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_lock.py +0 -0
  164. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_log_integrity.py +0 -0
  165. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_mcp.py +0 -0
  166. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_register.py +0 -0
  167. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_report.py +0 -0
  168. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_channel_status.py +0 -0
  169. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_class_field_arrow_binding.py +0 -0
  170. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_below_repository_root.py +0 -0
  171. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_build_missing_path.py +0 -0
  172. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_channel.py +0 -0
  173. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_channel_attribution.py +0 -0
  174. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_doctor_below_root.py +0 -0
  175. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_reference.py +0 -0
  176. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_usage.py +0 -0
  177. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cli_version.py +0 -0
  178. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cluster.py +0 -0
  179. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_compare_dist.py +0 -0
  180. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_configuration_reference.py +0 -0
  181. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_context.py +0 -0
  182. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_context_builder.py +0 -0
  183. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cwd_relative_config.py +0 -0
  184. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_cycle_search.py +0 -0
  185. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon.py +0 -0
  186. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_activation.py +0 -0
  187. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_build_lock.py +0 -0
  188. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_child_lock.py +0 -0
  189. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_engine_staleness.py +0 -0
  190. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_health.py +0 -0
  191. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_health_activation.py +0 -0
  192. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_launch.py +0 -0
  193. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_daemon_service_cli.py +0 -0
  194. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_debt.py +0 -0
  195. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_dependency_install.py +0 -0
  196. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_destructured_binding.py +0 -0
  197. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_determinism.py +0 -0
  198. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_dispatch_evidence.py +0 -0
  199. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_doctor.py +0 -0
  200. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_doctor_agent_hooks.py +0 -0
  201. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_doctor_hooks.py +0 -0
  202. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_doctor_managed_docs.py +0 -0
  203. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_doctor_probes.py +0 -0
  204. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_documentation.py +0 -0
  205. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_edit_apply.py +0 -0
  206. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_engine_identity.py +0 -0
  207. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_exit_codes_reference.py +0 -0
  208. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_external_calls.py +0 -0
  209. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_file_node_id_collision.py +0 -0
  210. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_git_security.py +0 -0
  211. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_go_rust.py +0 -0
  212. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_graph_io.py +0 -0
  213. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_graph_provider_isolation.py +0 -0
  214. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_hardening.py +0 -0
  215. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_health.py +0 -0
  216. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_hook_entry.py +0 -0
  217. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_hook_template.py +0 -0
  218. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_hookinstall.py +0 -0
  219. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_hookshim.py +0 -0
  220. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_html_security.py +0 -0
  221. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_incident_ledger.py +0 -0
  222. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_init.py +0 -0
  223. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_init_activation_doctrine.py +0 -0
  224. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_init_hooks.py +0 -0
  225. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_init_validation_exit.py +0 -0
  226. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_launchd_agent.py +0 -0
  227. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_lifecycle_operator.py +0 -0
  228. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_listing.py +0 -0
  229. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_listing_surfaces.py +0 -0
  230. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_llm.py +0 -0
  231. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_llm_probe.py +0 -0
  232. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_mcp.py +0 -0
  233. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_mcp_server.py +0 -0
  234. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_mcp_server_channel_attribution.py +0 -0
  235. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_member_call_receiver.py +0 -0
  236. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_method_dispatch_scope.py +0 -0
  237. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_monorepo.py +0 -0
  238. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_mutation_tests.py +0 -0
  239. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_natural_query.py +0 -0
  240. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_no_path_is_graded.py +0 -0
  241. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_node_identity.py +0 -0
  242. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_ollama_executor.py +0 -0
  243. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_overlays.py +0 -0
  244. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_path_leak_fixture.py +0 -0
  245. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_probe_diagnostics.py +0 -0
  246. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_probe_process.py +0 -0
  247. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_probe_workspace.py +0 -0
  248. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_process_contracts.py +0 -0
  249. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_programs.py +0 -0
  250. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_claude_probe.py +0 -0
  251. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_codex_probe.py +0 -0
  252. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_lifecycle.py +0 -0
  253. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_lifecycle_service.py +0 -0
  254. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_lifecycle_storage.py +0 -0
  255. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_observer.py +0 -0
  256. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_ollama_probe.py +0 -0
  257. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_openrouter_probe.py +0 -0
  258. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_provider_probe_runner.py +0 -0
  259. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_public_surface.py +0 -0
  260. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_published_schemas.py +0 -0
  261. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_pyscope.py +0 -0
  262. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_pyscopeoracle.py +0 -0
  263. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_builtin_named_symbols.py +0 -0
  264. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_import_bindings.py +0 -0
  265. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_inherits_edge.py +0 -0
  266. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_local_alias_call.py +0 -0
  267. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_reexport_follow.py +0 -0
  268. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_resolver.py +0 -0
  269. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_python_scope_identity.py +0 -0
  270. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_query_plan.py +0 -0
  271. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_reliability.py +0 -0
  272. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_replacement_audit.py +0 -0
  273. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_repository_root_ownership.py +0 -0
  274. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_resolve.py +0 -0
  275. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_review.py +0 -0
  276. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_route_pool.py +0 -0
  277. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_route_pool_execution.py +0 -0
  278. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_approval.py +0 -0
  279. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_benchmark.py +0 -0
  280. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_classifier.py +0 -0
  281. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_claude_executor.py +0 -0
  282. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_cli.py +0 -0
  283. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_cli_contracts.py +0 -0
  284. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_cli_recovery.py +0 -0
  285. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_codex_executor.py +0 -0
  286. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_context.py +0 -0
  287. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_contracts.py +0 -0
  288. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_diff_policy.py +0 -0
  289. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_executor.py +0 -0
  290. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_openrouter_executor.py +0 -0
  291. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_policy.py +0 -0
  292. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_process_runner.py +0 -0
  293. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_profiles.py +0 -0
  294. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_registry.py +0 -0
  295. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_schema_validation.py +0 -0
  296. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_security.py +0 -0
  297. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_service.py +0 -0
  298. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_shadow.py +0 -0
  299. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_storage.py +0 -0
  300. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_telemetry.py +0 -0
  301. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_worktree.py +0 -0
  302. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_zai_executor.py +0 -0
  303. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_routing_zai_probe.py +0 -0
  304. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_savings.py +0 -0
  305. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_search.py +0 -0
  306. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_self_super_dispatch.py +0 -0
  307. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_smoke.py +0 -0
  308. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_sqloracle.py +0 -0
  309. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_synthetic_repo.py +0 -0
  310. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_systemd_unit.py +0 -0
  311. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_ts_bridge.py +0 -0
  312. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_typescript_activation.py +0 -0
  313. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_typescript_resolver.py +0 -0
  314. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_usage_ledger.py +0 -0
  315. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_verify_artifact.py +0 -0
  316. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_verify_published_release.py +0 -0
  317. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_watch.py +0 -0
  318. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_windows_startup.py +0 -0
  319. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_windows_task.py +0 -0
  320. {graphite_code-1.4.0 → graphite_code-1.5.0}/tests/test_zai_edit.py +0 -0
@@ -15,6 +15,164 @@ machine-checkable identity; the version is for humans.
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [1.5.0] — 2026-10-26
19
+
20
+ A minor release: one fix to the agent hooks' savings line (#110), and with
21
+ it one environment variable added to the configuration surface. No command,
22
+ option, JSON field, exit code or entry point is added, removed or renamed,
23
+ the ledger's other fields and the hook's wire format are unchanged, and
24
+ `Requires-Dist` and the entry points are those of 1.4.1.
25
+
26
+ The graph changes by what this fix adds. Measured on this repository: the
27
+ 1.4.1 release tree and this one, each built by the same interpreter with the
28
+ same parsers, into fresh output, cache and state directories:
29
+
30
+ - 9,221 nodes become 9,244 and 25,347 edges become 25,415. The 23 new
31
+ nodes are the two functions this fix adds (`current_session_id`,
32
+ `_entry_is_this_session`), the fixture that keeps the suite hermetic, the
33
+ eighteen functions and the file of the new test file, and the
34
+ `os.environ.get` call site;
35
+ - 6,664 of 6,691 definition ids survive naming the same definition at the
36
+ same line, and 27 survive by id but move line -- every one of them in the
37
+ three files this change touches (`agent_hooks.py` 3, `usage_ledger.py` 13,
38
+ `conftest.py` 11). No definition id is removed and 21 are new;
39
+ - `contains` goes from 6,689 relation triples to 6,710 and `imports` from
40
+ 2,457 to 2,465; `calls` goes from 16,251 to 16,290; `inherits` (120) is
41
+ unchanged. 25,517 relation triples become 25,585, with none removed;
42
+ - 18 cycles where there were 18, the same ones, and 177 communities where
43
+ there were 179;
44
+ - two builds of this tree are byte-identical.
45
+
46
+ `metadata.engine.fingerprint` moves, as it does whenever the engine's
47
+ environment changes: it folds in the parser versions present, and the
48
+ interpreter's tree-sitter-python moved from 0.25.2 to 0.26.0 since 1.4.1's
49
+ build. The graph is unchanged by that: the same tree built by both parser
50
+ versions gives the same ids, the same edges and the same triples, node for
51
+ node.
52
+
53
+ ### Added
54
+
55
+ **`GRAPHITE_SESSION_ID` names the session a usage-ledger entry belongs to**
56
+ (#110). This release adds to the configuration surface, so
57
+ `docs/reference/configuration.md` now lists the new variable together with
58
+ the two harness variables graphite falls back to when it is unset --
59
+ `CLAUDE_CODE_SESSION_ID` and `CODEX_COMPANION_SESSION_ID`. The first of the
60
+ three that is set is the one an entry records. Unset means the entry is
61
+ recorded untagged and every session counts it, as it did before.
62
+
63
+ ### Fixed
64
+
65
+ **Two sessions open in one repository no longer count each other's use**
66
+ (#110). The usage ledger is per repository and every session appends to it,
67
+ and an entry said nothing about who made it. So where two sessions were open
68
+ at once each one's Stop counted the other's queries as its own: the second
69
+ session's Stop saw the first session's query, because that query was written
70
+ after the second session's books were opened, and the first session's next
71
+ Stop saw the second's. Each session reported the other's use as saved "this
72
+ turn", and both session totals ended at both.
73
+
74
+ An entry now records the session that made it, and a Stop counts only the
75
+ entries that name its own session. The tag is what the process can know:
76
+ `GRAPHITE_SESSION_ID` first, then `CLAUDE_CODE_SESSION_ID`, then
77
+ `CODEX_COMPANION_SESSION_ID`, the first that is set -- the same value the
78
+ Stop hook is given, so an entry and the hook that counts it name one session.
79
+ An entry no session can be attributed to -- a person running graphite in a
80
+ terminal in the same repository -- is counted as it was, so no real use is
81
+ dropped. The ledger's other fields, the hook's wire format and
82
+ `graphite savings` are unchanged: that command reports the repository's
83
+ totals, which is what it is for.
84
+
85
+ ## [1.4.1] — 2026-10-25
86
+
87
+ A patch release: three fixes, two to the Python graph (#106, #107) and one
88
+ to the agent hooks' savings line (#108). No field, command or option is
89
+ added, removed or renamed, and `Requires-Dist` and the entry points are
90
+ those of 1.4.0.
91
+
92
+ The graph changes in this release. On this repository, measured against the
93
+ deployed 1.4.0 engine, with the same interpreter, from one tree:
94
+
95
+ - every definition and file node id survives (6,691 and 429), each naming
96
+ the same definition or file, and none is new; 10 placeholder nodes are
97
+ gone, so 9,231 nodes become 9,221;
98
+ - 59 call sites that ended at a placeholder for a name a module only
99
+ imports now end at the function or class that name is (#107);
100
+ - 14 calls edges at 10 sites are gone: each was a `super().__init__` in an
101
+ error class over a builtin exception, bound by name to an unrelated
102
+ constructor (#106). `calls` goes from 16,265 to 16,251 edges, and the
103
+ Python `calls` ratio from 0.978 to 0.983: 12,236 of 12,452 call sites
104
+ are bound, where 12,191 of 12,466 were;
105
+ - `contains` is unchanged: 6,519 edges, and 6,689 relation triples, the
106
+ difference being 170 edges that carry `contains` as a second relation
107
+ beside `calls`. `imports` (2,457) and `inherits` (120) are unchanged;
108
+ - `analysis` lists 18 cycles where it listed 20: the two it no longer lists
109
+ ran through those edges. Entry points, god nodes, orphans, surprising
110
+ connections and top files are identical; the community count goes from
111
+ 174 to 179.
112
+
113
+ Two builds of this tree with either engine are byte-identical (`graph.json`,
114
+ `GRAPH_REPORT.md`, `graph.html`).
115
+
116
+ The entries below quote figures measured when each change was made, on
117
+ earlier commits of this tree, so they differ from the ones above.
118
+
119
+ ### Fixed
120
+
121
+ - Python: a name a module only imports is followed to the file that defines
122
+ it (#107). Where `front.py` binds `target` by `from pkg.impl import target`
123
+ and nothing else, `front.target(x)` from another file, the local alias
124
+ `t = front.target; t(x)` (#90) and `from pkg.front import target` each
125
+ ended at a placeholder `pkg_front_py_target` that no file defines, so
126
+ `callers target` left the caller out while `callees` of the caller
127
+ answered `decision_grade` with that placeholder. #87 followed such a name
128
+ through a package's `__init__.py` only, and only for `from pkg import
129
+ name`: `import pkg; pkg.name()` stayed at the package. Each Python module
130
+ now records the names it binds only by one top-level `from X import name`,
131
+ by the rule #87 applies, and the dispatch post-pass follows them across
132
+ files for as many hops as the source states: a call or `inherits` target,
133
+ a stated receiver (`Base().step()`) and the bases a `self.m()` or
134
+ `super().m()` is looked up along all end at the definition. A name the
135
+ module binds any other way too is not followed, and neither is a
136
+ submodule (`from pkg import sub`); a name a function of the module
137
+ rebinds under `global` is no longer followed either, through
138
+ `__init__.py` as elsewhere. A star import is not read: a name it could
139
+ rebind is followed all the same. What a module records is on its own
140
+ cached extraction, so a change to it reaches an unchanged caller with no
141
+ new cache key. On this repository, the #106 engine against this one with
142
+ one interpreter, from one tree: 59 calls edges, at 59 sites, move from
143
+ 10 placeholders to the functions and classes they name, and nothing else
144
+ changes. Those placeholder nodes are gone, every definition id is the same,
145
+ and the Python `calls` ratio goes from 0.978 to 0.983.
146
+ - Python: `super().m()` has no edge where the method it finds is a builtin's
147
+ (#106). In `class StepError(AppError)` with `AppError(RuntimeError)`,
148
+ `super().__init__(message)` runs `RuntimeError.__init__`, but the binding by
149
+ class read the builtin base as one it cannot read, found no class of the
150
+ repository with an `__init__`, and left the call to the name: it was a call
151
+ to every `__init__` in reach, up to three, at `decision_grade`. On this
152
+ repository 14 such edges went to constructors of unrelated classes, and two
153
+ entries of `analysis.cycles` ran through them. Where no class the source
154
+ states binds the name, every other base on the way is a builtin class the
155
+ file does not bind, and a builtin (or `object`) has the name, the call now
156
+ has no edge, as a call of a builtin has none. A name no builtin of the chain
157
+ has, a base that cannot be read beside the builtin, a class with no base,
158
+ and `self.m()` are bound as before.
159
+ - Agent hooks: a session's savings line no longer counts what other
160
+ sessions ran before it started or while it was away (#108). The usage
161
+ ledger holds every session's entries, and a session the stop cursor had
162
+ not seen started reading it at byte 0, so its first Stop reported all
163
+ earlier sessions' use as saved "this turn" and its session total carried
164
+ that history from then on, and
165
+ a resumed session counted everything other sessions had run since its
166
+ last turn. SessionStart now opens a new session's books where the ledger
167
+ ends, and on a resume moves a known session's books there, keeping its
168
+ totals; a compact falls inside a turn and leaves them where they are. A
169
+ Stop for a session with no books (its start was not seen, or it was
170
+ pruned from the cursor) starts at the ledger's end too: that turn's own
171
+ use is not counted, and no other session's is; neither is the use of a
172
+ turn whose Stop never fired before a resume. Two sessions open in one
173
+ repository at once still each count what the other ran between two of
174
+ their turns: a ledger entry does not say which session made it.
175
+
18
176
  ## [1.4.0] — 2026-10-25
19
177
 
20
178
  A minor release: eight fixes, to the Python graph, the build, the CLI and the
@@ -41,7 +199,9 @@ deployed 1.3.0 engine, with the same interpreter, from one tree:
41
199
  ended at a placeholder named for the local: 16 now end at a definition,
42
200
  and 5 at a placeholder for a name the module only imports, which is where
43
201
  a direct call of it already ended (#90; that gap is #107). One call site is
44
- new (#85). `contains` (6,614) and `imports` (2,431) are unchanged, and
202
+ new (#85). `contains` is 6,446 edges where 1.3.0 held 6,447, and 6,614
203
+ relation triples on both sides: 168 edges carry `contains` as a second
204
+ relation beside `calls` where 167 did. `imports` (2,431) is unchanged, and
45
205
  25,177 of the 25,230 edge triples are unchanged;
46
206
  - the Python `calls` ratio goes from 0.976 to 0.978: 12,001 of 12,276 call
47
207
  sites are bound, where 11,984 of 12,275 were;
@@ -161,8 +321,10 @@ one tree:
161
321
  - all 9,031 node ids survive, each naming the same definition, file or
162
322
  placeholder, and none is new;
163
323
  - `calls` goes from 15,811 to 15,771: 44 call triples are gone and 4 are
164
- new. `contains` (6,502), `imports` (2,383) and `inherits` (120) are
165
- unchanged, and 24,772 of 24,816 edge triples are unchanged;
324
+ new. `contains` is unchanged: 6,337 edges, and 6,502 relation triples, the
325
+ difference being 165 edges that carry `contains` as a second relation
326
+ beside `calls`. `imports` (2,383) and `inherits` (120) are unchanged, and
327
+ 24,772 of 24,816 edge triples are unchanged;
166
328
  - `analysis` (20 cycles, entry points, god nodes, orphans) is identical. The
167
329
  community count goes from 169 to 170;
168
330
  - the Python `calls` ratio is 0.976 before and after. The cell counts 40
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  Summary: Local-first, zero-LLM knowledge graph extraction for codebases.
5
5
  Project-URL: Homepage, https://github.com/jared0565/graphite
6
6
  Project-URL: Repository, https://github.com/jared0565/graphite
@@ -48,7 +48,7 @@ Description-Content-Type: text/markdown
48
48
 
49
49
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
50
50
 
51
- **Status: 1.4.0, production/stable.** Published on PyPI as
51
+ **Status: 1.5.0, production/stable.** Published on PyPI as
52
52
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
53
53
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
54
54
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
4
4
 
5
- **Status: 1.4.0, production/stable.** Published on PyPI as
5
+ **Status: 1.5.0, production/stable.** Published on PyPI as
6
6
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
7
7
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
8
8
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -38,4 +38,4 @@ __all__ = ["__version__"]
38
38
  #: Coarse and hand-maintained by construction. It is a release label, not
39
39
  #: evidence that a given fix is present -- to answer that, survey for the marker
40
40
  #: the fix introduced, or compare `graphite --version` fingerprints.
41
- __version__ = "1.4.0"
41
+ __version__ = "1.5.0"
@@ -136,6 +136,7 @@ def handle_session_start(payload: dict[str, Any]) -> dict[str, Any] | None:
136
136
  cwd = _payload_cwd(payload)
137
137
  root = _repo_root(cwd)
138
138
  _activate(root)
139
+ _open_session_books(root, str(payload.get("session_id") or ""), str(payload.get("source") or ""))
139
140
  if (root / "graph-out" / "graph.json").is_file():
140
141
  state, reason = _freshness_within_budget(root)
141
142
  if state == "stale":
@@ -1295,6 +1296,43 @@ def _strict_denial(payload: dict[str, Any], root: Path, cwd: Path | None = None)
1295
1296
  MAX_CURSOR_SESSIONS = 20
1296
1297
 
1297
1298
 
1299
+ def _keep_newest_sessions(sessions: dict[str, Any]) -> None:
1300
+ while len(sessions) > MAX_CURSOR_SESSIONS:
1301
+ sessions.pop(next(iter(sessions)))
1302
+
1303
+
1304
+ def _open_session_books(root: Path, session_id: str, source: str) -> None:
1305
+ """Start a new session's savings books where the usage ledger ends now.
1306
+
1307
+ The ledger holds every session's entries, so a session that counted from
1308
+ byte 0 took all of them as its own (#108). A session the cursor already
1309
+ knows keeps its totals: SessionStart fires again on a resume or a compact.
1310
+ On a resume its books move to the ledger's end as well: what the ledger
1311
+ gained while it was away is other sessions' use, and a turn of its own
1312
+ whose Stop never fired is not counted. A compact falls inside a turn, so
1313
+ the books stay where they are.
1314
+ """
1315
+ try:
1316
+ if not session_id:
1317
+ return
1318
+ sessions = usage_ledger.read_cursor(root).get("sessions")
1319
+ if not isinstance(sessions, dict):
1320
+ sessions = {}
1321
+ known = sessions.pop(session_id, None)
1322
+ if isinstance(known, dict) and source != "resume":
1323
+ return
1324
+ ledger = usage_ledger.ledger_path(root)
1325
+ ledger_stat = ledger.stat() if ledger.is_file() else None
1326
+ books = known if isinstance(known, dict) else {"tokens": 0, "seconds": 0.0}
1327
+ books["offset"] = ledger_stat.st_size if ledger_stat is not None else 0
1328
+ books["ino"] = ledger_stat.st_ino if ledger_stat is not None else None
1329
+ sessions[session_id] = books
1330
+ _keep_newest_sessions(sessions)
1331
+ usage_ledger.write_cursor(root, {"sessions": sessions})
1332
+ except Exception:
1333
+ return
1334
+
1335
+
1298
1336
  def _entries_between(path: Path, start: int, end: int) -> list[dict[str, Any]]:
1299
1337
  entries: list[dict[str, Any]] = []
1300
1338
  with open(path, "rb") as handle:
@@ -1310,6 +1348,21 @@ def _entries_between(path: Path, start: int, end: int) -> list[dict[str, Any]]:
1310
1348
  return entries
1311
1349
 
1312
1350
 
1351
+ def _entry_is_this_session(entry: dict[str, Any], session_id: str) -> bool:
1352
+ """Whether a ledger entry is this session's own use.
1353
+
1354
+ An entry that names no session is counted, as it was: a person running
1355
+ graphite in a terminal in the same repository is real use, and dropping
1356
+ it would understate what the graph saved. An entry that names another
1357
+ session is that session's, and where two sessions are open at once each
1358
+ one's Stop would otherwise claim the other's use as its own (#110).
1359
+ """
1360
+ tag = entry.get("session")
1361
+ if not isinstance(tag, str) or not tag:
1362
+ return True
1363
+ return tag == session_id
1364
+
1365
+
1313
1366
  def _cursor_number(value: Any, cast: type) -> Any:
1314
1367
  """Coerce a possibly-corrupted cursor field; non-numeric (or bool) -> 0.
1315
1368
 
@@ -1348,7 +1401,11 @@ def handle_stop(payload: dict[str, Any]) -> dict[str, Any] | None:
1348
1401
  sessions = {}
1349
1402
  state = sessions.pop(session_id, None)
1350
1403
  if not isinstance(state, dict):
1351
- state = {"offset": 0, "tokens": 0, "seconds": 0.0, "ino": current_ino}
1404
+ # No books were opened for this session: its SessionStart was not
1405
+ # seen, or the session was pruned from the cursor. What the ledger
1406
+ # holds now is other sessions' history (#108), so the books start
1407
+ # at its end. This turn's own entries are lost; none are invented.
1408
+ state = {"offset": size, "tokens": 0, "seconds": 0.0, "ino": current_ino}
1352
1409
  offset = state.get("offset", 0)
1353
1410
  stored_ino = state.get("ino")
1354
1411
  # A stored `ino` that isn't an int (missing key on the older 3-key cursor
@@ -1367,9 +1424,12 @@ def handle_stop(payload: dict[str, Any]) -> dict[str, Any] | None:
1367
1424
  if not isinstance(offset, int) or offset > size or rotated:
1368
1425
  offset = 0 # ledger rotated or cursor damaged; resync
1369
1426
  new_entries = _entries_between(ledger, offset, size) if size > offset else []
1427
+ # The ledger holds every session's entries, and where two sessions are
1428
+ # open at once each one's Stop must claim only its own use (#110).
1429
+ own_entries = [entry for entry in new_entries if _entry_is_this_session(entry, session_id)]
1370
1430
  turn_tokens = 0
1371
1431
  turn_seconds = 0.0
1372
- for entry in new_entries:
1432
+ for entry in own_entries:
1373
1433
  est = savings_model.estimate_entry(entry)
1374
1434
  turn_tokens += est["tokens_saved"]
1375
1435
  turn_seconds += est["seconds_saved"]
@@ -1378,10 +1438,9 @@ def handle_stop(payload: dict[str, Any]) -> dict[str, Any] | None:
1378
1438
  state["tokens"] = _cursor_number(state.get("tokens", 0), int) + turn_tokens
1379
1439
  state["seconds"] = _cursor_number(state.get("seconds", 0.0), float) + turn_seconds
1380
1440
  sessions[session_id] = state # re-insert -> newest position
1381
- while len(sessions) > MAX_CURSOR_SESSIONS:
1382
- sessions.pop(next(iter(sessions)))
1441
+ _keep_newest_sessions(sessions)
1383
1442
  usage_ledger.write_cursor(root, {"sessions": sessions})
1384
- if not new_entries or not usage_ledger.savings_display_enabled(root):
1443
+ if not own_entries or not usage_ledger.savings_display_enabled(root):
1385
1444
  return None
1386
1445
  turn_text = savings_model.format_compact(turn_tokens, turn_seconds)
1387
1446
  session_text = savings_model.format_compact(state["tokens"], state["seconds"])
@@ -1,6 +1,7 @@
1
1
  """Deterministic structural extraction via tree-sitter."""
2
2
  from __future__ import annotations
3
3
 
4
+ import builtins
4
5
  import hashlib
5
6
  import importlib
6
7
  import re
@@ -15,7 +16,7 @@ from ..cache import Cache
15
16
  from ..config import Config
16
17
  from ..graph import normalize_id
17
18
  from ..ingest import LANGUAGE_BY_EXT, FileEntry
18
- from ..resolve import SourceIndex, should_keep_call_target
19
+ from ..resolve import MAX_REEXPORT_HOPS, SourceIndex, python_reexports_of, should_keep_call_target
19
20
  from .pyscope import (
20
21
  PyScope,
21
22
  Resolution,
@@ -1420,6 +1421,30 @@ def _python_import_bindings(
1420
1421
  return out
1421
1422
 
1422
1423
 
1424
+ def _python_module_reexports(
1425
+ file_id: str, rel_path: str, source: bytes, source_index: SourceIndex
1426
+ ) -> dict[str, str]:
1427
+ """`<module>.<name>` -> where the module's own `from X import name` says it is (#107).
1428
+
1429
+ The key is the id a call of `module.name` gets, `_make_id(<file id>,
1430
+ <name>)`; the value is the id of `name` in the file `X` resolves to. Only
1431
+ a name the module binds by that one statement is recorded (the rule #87
1432
+ applies to a package's `__init__.py`), and one that names a submodule
1433
+ (`from pkg import sub`) is not: `pkg.sub` is the module, not a name of
1434
+ `pkg`. The dispatch post-pass follows these across files, so a value
1435
+ depends on the module's own bytes and the file set alone, as its cache
1436
+ key does.
1437
+ """
1438
+ out: dict[str, str] = {}
1439
+ for (_, local), (module, level, original) in python_reexports_of(rel_path, source).items():
1440
+ if source_index.resolve_python_module(rel_path, f"{module}.{original}", level):
1441
+ continue
1442
+ defining = source_index.resolve_python_module(rel_path, module, level)
1443
+ if defining:
1444
+ out[_make_id(file_id, local)] = _make_id(_file_node_id(defining, source_index), original)
1445
+ return out
1446
+
1447
+
1423
1448
  def _python_definition_name(node: Any) -> str | None:
1424
1449
  """A def/class node's name exactly as its graph node records it."""
1425
1450
  name_node = node.child_by_field_name("name")
@@ -1559,14 +1584,21 @@ def _python_attribute_root(node: Any) -> str | None:
1559
1584
  return None
1560
1585
 
1561
1586
 
1562
- def _extract_python(file_id: str, rel_path: str, _source: bytes, tree: Any, source_index: SourceIndex | None = None) -> ExtractionResult:
1587
+ def _extract_python(file_id: str, rel_path: str, source: bytes, tree: Any, source_index: SourceIndex | None = None) -> ExtractionResult:
1563
1588
  result = ExtractionResult()
1564
1589
  root = tree.root_node
1565
1590
 
1566
1591
  def _line(node: Any) -> int:
1567
1592
  return node.start_point[0] + 1
1568
1593
 
1569
- result.nodes.append(_node(file_id, "file", Path(rel_path).name, rel_path))
1594
+ file_node = _node(file_id, "file", Path(rel_path).name, rel_path)
1595
+ if source_index is not None:
1596
+ # For the dispatch post-pass, which takes it off again: what a call of
1597
+ # `<this module>.<name>` reaches where the module only imports the name.
1598
+ reexports = _python_module_reexports(file_id, rel_path, source, source_index)
1599
+ if reexports:
1600
+ file_node["_reexports"] = reexports
1601
+ result.nodes.append(file_node)
1570
1602
 
1571
1603
  # One pass builds every Python scope and what each binds (#70, #71). The walk
1572
1604
  # below reads it: each def/class gets its scope-qualified identity, and each
@@ -1604,8 +1636,9 @@ def _extract_python(file_id: str, rel_path: str, _source: bytes, tree: Any, sour
1604
1636
  class_node = _node(did, "class", name, rel_path, _line(node), {"qualname": qualname})
1605
1637
  body_scope = table.class_scope.get(node.id)
1606
1638
  if body_scope is not None and body_scope.parent is not None:
1607
- # For the dispatch post-pass (#73), which takes all five off
1608
- # again: the bases in order, the names the body binds in some
1639
+ # For the dispatch post-pass (#73), which takes all six off
1640
+ # again: the bases in order, which of them are builtin classes
1641
+ # (#106), the names the body binds in some
1609
1642
  # other way than one `def` written straight in it (a `def`
1610
1643
  # under an `if` is there only if the `if` ran it, and one
1611
1644
  # under `global` or `nonlocal` binds the name somewhere
@@ -1614,7 +1647,9 @@ def _extract_python(file_id: str, rel_path: str, _source: bytes, tree: Any, sour
1614
1647
  # is made beyond its body and bases. With them `self.m()` and
1615
1648
  # `super().m()` are bound to the method Python finds, not to
1616
1649
  # every method called `m`.
1617
- class_node["_bases"] = _python_class_bases(node, body_scope.parent, table, ids)
1650
+ class_node["_bases"], class_node["_builtin_bases"] = _python_class_bases(
1651
+ node, body_scope.parent, table, ids
1652
+ )
1618
1653
  class_node["_stops"] = sorted(
1619
1654
  {
1620
1655
  bound for bound, binders in body_scope.binders.items()
@@ -2254,7 +2289,7 @@ _MAX_METHOD_DISPATCH_CANDIDATES = 3
2254
2289
 
2255
2290
  def _python_class_bases(
2256
2291
  node: Any, scope: PyScope, table: ScopeTable, ids: dict[tuple[str, bool], str]
2257
- ) -> list[str | None]:
2292
+ ) -> tuple[list[str | None], list[str | None]]:
2258
2293
  """Each base of a class statement, in order: the id of the class it names, or None.
2259
2294
 
2260
2295
  A base is resolved where the source states it: a bare name that denotes a
@@ -2264,15 +2299,26 @@ def _python_class_bases(
2264
2299
  It may bind any name, and it may derive from a class that was read.
2265
2300
  `object` is left out: it is last in every linearisation and defines no
2266
2301
  method of the repository. Class keywords (`metaclass=...`) are not bases.
2302
+
2303
+ The second list is as long as the first: the name of the builtin class a
2304
+ base is, where it is one (a bare name the file does not bind), and None
2305
+ elsewhere. Only `super()` reads it (#106): no class of the repository
2306
+ stands behind a builtin, so where the method `super()` finds is a
2307
+ builtin's, it is none of the repository's. A star import may bind the
2308
+ name; `super()` itself is not read beside one (`_is_bare_super`), so the
2309
+ list needs no check of its own for it.
2267
2310
  """
2268
2311
  bases: list[str | None] = []
2312
+ builtin_bases: list[str | None] = []
2269
2313
  arguments = node.child_by_field_name("superclasses")
2270
2314
  for arg in arguments.named_children if arguments is not None else ():
2271
2315
  if arg.type in ("comment", "keyword_argument", "dictionary_splat"):
2272
2316
  continue
2273
- found = resolve(scope, arg.text.decode("utf-8", errors="ignore")) if arg.type == "identifier" else None
2317
+ written = arg.text.decode("utf-8", errors="ignore")
2318
+ found = resolve(scope, written) if arg.type == "identifier" else None
2274
2319
  if found is not None and found.kind in ("def", "symbol"):
2275
2320
  bases.append(_python_definition_id(found, ids))
2321
+ builtin_bases.append(None)
2276
2322
  elif (
2277
2323
  found is not None and found.kind == "none"
2278
2324
  and arg.text == b"object" and not table.module.star_import
@@ -2280,7 +2326,28 @@ def _python_class_bases(
2280
2326
  continue
2281
2327
  else:
2282
2328
  bases.append(None)
2283
- return bases
2329
+ builtin = (
2330
+ found is not None and found.kind == "none"
2331
+ and isinstance(getattr(builtins, written, None), type)
2332
+ )
2333
+ builtin_bases.append(written if builtin else None)
2334
+ return bases, builtin_bases
2335
+
2336
+
2337
+ #: What `class_method` answers where the method `super()` finds is a builtin's (#106).
2338
+ _A_BUILTIN_S_METHOD = "<builtin>"
2339
+
2340
+
2341
+ def _a_builtin_has(builtin_names: Collection[str], method: str) -> bool:
2342
+ """Whether a method lookup that reaches these builtin classes finds `method`
2343
+ in one of them or in a class they derive from (`object` among them).
2344
+
2345
+ Each class's own namespace is read, not `hasattr`: `hasattr(dict, "mro")`
2346
+ is true because `type` defines `mro`, and `super()` never looks there.
2347
+ """
2348
+ return any(
2349
+ method in vars(cls) for name in builtin_names for cls in getattr(builtins, name).__mro__
2350
+ )
2284
2351
 
2285
2352
 
2286
2353
  def _python_class_making(node: Any, scope: PyScope, table: ScopeTable) -> list[str]:
@@ -2527,6 +2594,46 @@ def _dispatch_is_gated(source_file: str | None) -> bool:
2527
2594
  return language in _DISPATCH_GATED_LANGUAGES
2528
2595
 
2529
2596
 
2597
+ def _follow_python_reexports(nodes: list[dict[str, Any]], edges: list[dict[str, Any]]) -> None:
2598
+ """Re-point each id of a name a Python module only imports to its definition (#107).
2599
+
2600
+ `front.target(x)`, where `front.py` binds `target` only by `from pkg.impl
2601
+ import target`, was extracted as a call of `pkg_front_py_target`, which no
2602
+ file defines; so were `t = front.target; t(x)`, `from pkg.front import
2603
+ target` and a base class or receiver named that way. Each module's own
2604
+ imports are on its file node (`_reexports`); here they are followed across
2605
+ files, for as many hops as the source states, to the id the last module
2606
+ names. A definition is never moved: a module that defines a name binds it
2607
+ twice, and such a name is not recorded. A cycle stops at
2608
+ `MAX_REEXPORT_HOPS`, on an id no file defines.
2609
+
2610
+ Edge targets of every relation are re-pointed, and so are ``_receiver``
2611
+ on an edge and ``_bases`` on a class node, the other two places a
2612
+ definition id is read; ``_reexports`` is taken off every node.
2613
+ """
2614
+ hops: dict[str, str] = {}
2615
+ for n in nodes:
2616
+ hops.update(n.pop("_reexports", None) or {})
2617
+ if not hops:
2618
+ return
2619
+
2620
+ def follow(target: str) -> str:
2621
+ for _ in range(MAX_REEXPORT_HOPS):
2622
+ hop = hops.get(target)
2623
+ if hop is None:
2624
+ break
2625
+ target = hop
2626
+ return target
2627
+
2628
+ for e in edges:
2629
+ e["target"] = follow(e["target"])
2630
+ if e.get("_receiver") is not None:
2631
+ e["_receiver"] = follow(e["_receiver"])
2632
+ for n in nodes:
2633
+ if n.get("_bases") is not None:
2634
+ n["_bases"] = [None if base is None else follow(base) for base in n["_bases"]]
2635
+
2636
+
2530
2637
  def _resolve_method_dispatch(
2531
2638
  nodes: list[dict[str, Any]], edges: list[dict[str, Any]]
2532
2639
  ) -> list[dict[str, Any]]:
@@ -2590,9 +2697,23 @@ def _resolve_method_dispatch(
2590
2697
  `__init_subclass__` there can set a name on the class itself, over its own
2591
2698
  `def`. So "bound" says what the classes that were read state, and not more.
2592
2699
 
2700
+ One case of a base that was not read is read for `super()` alone (#106):
2701
+ a builtin class, named in ``_builtin_bases``. No class of the repository
2702
+ stands behind a builtin. So where no class that was read binds the name,
2703
+ every base that was not read is a builtin, and a builtin (or `object`)
2704
+ has the name, what `super()` finds is the builtin's, and the call gets no
2705
+ edge, as a call of a builtin gets none. Bound by name, it was a call to
2706
+ every method of the name in reach.
2707
+
2708
+ Before any of it, a name a Python module only imports is followed to its
2709
+ definition (`_follow_python_reexports`, #107), so the ids read below are
2710
+ the definitions' own.
2711
+
2593
2712
  ``_member``, ``_receiver`` and ``_walk`` are stripped from every returned
2594
- edge, and the five class tags from every node, so none leaks into the graph.
2713
+ edge, and the six class tags and ``_reexports`` from every node, so none
2714
+ leaks into the graph.
2595
2715
  """
2716
+ _follow_python_reexports(nodes, edges)
2596
2717
  # method name (casefolded) -> set of definition node ids. A set collapses the
2597
2718
  # same method appearing twice in the pre-dedup node list, so the cap counts
2598
2719
  # distinct definitions.
@@ -2617,14 +2738,17 @@ def _resolve_method_dispatch(
2617
2738
  instance_binds_of: dict[str, frozenset[str]] = {}
2618
2739
  class_binds_of: dict[str, frozenset[str]] = {}
2619
2740
  made_of: dict[str, frozenset[str]] = {}
2741
+ builtin_bases_of: dict[str, list[str | None]] = {}
2620
2742
  for n in nodes:
2621
2743
  bases = n.pop("_bases", None)
2744
+ builtin_bases = n.pop("_builtin_bases", None)
2622
2745
  stops = n.pop("_stops", None)
2623
2746
  instance_binds = n.pop("_self_binds", None)
2624
2747
  class_binds = n.pop("_class_binds", None)
2625
2748
  made = n.pop("_made", None)
2626
2749
  if bases is not None:
2627
2750
  bases_of[n["id"]] = bases
2751
+ builtin_bases_of[n["id"]] = list(builtin_bases or ())
2628
2752
  stops_of[n["id"]] = frozenset(stops or ())
2629
2753
  instance_binds_of[n["id"]] = frozenset(instance_binds or ())
2630
2754
  class_binds_of[n["id"]] = frozenset(class_binds or ())
@@ -2687,6 +2811,21 @@ def _resolve_method_dispatch(
2687
2811
  if (walk == "self" if current == cls else not private)
2688
2812
  and ("decorator" in made_of[current] or body_binds(current, method))
2689
2813
  ]
2814
+ if walk == "super" and not binders and unread:
2815
+ # No class that was read binds the name. Where every base that
2816
+ # was not read is a builtin, no class of the repository stands
2817
+ # behind any of them, and one of them has the name, `super()`
2818
+ # finds a builtin's method (#106).
2819
+ builtin_names: list[str] = []
2820
+ for current, position in unread:
2821
+ named = builtin_bases_of.get(current, [])
2822
+ builtin = named[position] if position < len(named) else None
2823
+ if builtin is None:
2824
+ break
2825
+ builtin_names.append(builtin)
2826
+ else:
2827
+ if _a_builtin_has(builtin_names, method):
2828
+ return _A_BUILTIN_S_METHOD
2690
2829
  if not unread:
2691
2830
  # Every base was read, so the order is Python's own.
2692
2831
  line = _c3_linearisation(cls, bases_of, linearisations) or ()
@@ -2768,6 +2907,10 @@ def _resolve_method_dispatch(
2768
2907
  # `self.m()` / `super().m()`: the first `m` along the bases of the
2769
2908
  # class the call is written in (#73).
2770
2909
  own = class_method(receiver, method, walk)
2910
+ if own == _A_BUILTIN_S_METHOD:
2911
+ # What runs is a builtin's method: no edge, as a call of a
2912
+ # builtin has none (#106).
2913
+ continue
2771
2914
  else:
2772
2915
  own = own_methods.get(receiver, {}).get(method) if receiver else None
2773
2916
  if own is not None: