graphite-code 1.4.1__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.
- {graphite_code-1.4.1 → graphite_code-1.5.0}/CHANGELOG.md +77 -5
- {graphite_code-1.4.1 → graphite_code-1.5.0}/PKG-INFO +2 -2
- {graphite_code-1.4.1 → graphite_code-1.5.0}/README.md +1 -1
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/__init__.py +1 -1
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/agent_hooks.py +20 -2
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/usage_ledger.py +27 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/conftest.py +17 -1
- graphite_code-1.5.0/tests/test_agent_hooks_session_tagging.py +172 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/.gitignore +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/ARCHITECTURE.md +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/CONTRIBUTING.md +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/LICENSE +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/RELEASING.md +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/pyproject.toml +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/__main__.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/_cleanup_worker.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/_win32_ctypes.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/agent_settings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/analyze.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/answer_contract.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/bootstrap.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/buildlock.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/cache.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/channel.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/cli.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/cluster.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/config.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/context.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/daemon.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/daemon_health.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/daemon_launch.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/debt.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/dependency_install.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/detach.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/doctor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/doctor_probes.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/engine_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/export/__init__.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/export/html.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/export/json.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/export/md.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/extract/__init__.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/extract/ast.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/extract/pyscope.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/freshness.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/git.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/graph.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/graph_io.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/health.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/hook_entry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/hookinstall.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/hookshim.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/incident_ledger.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/ingest.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/init.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/io.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/launchd_agent.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/listing.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/llm.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/llm_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/mcp.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/mcp_server.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/natural_query.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/overlays.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/ownership.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/probe_process.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/probe_workspace.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/process_contracts.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/programs.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/provider_observer.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/py.typed +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/query.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/query_plan.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/replacement_audit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/resolve.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/review.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/__init__.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/approval.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/classifier.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/claude_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/claude_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/cli_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/codex_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/codex_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/context_builder.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/contracts.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/diff_policy.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/edit_apply.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/effort.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/lifecycle.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_operator.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_service.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/lifecycle_storage.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/ollama_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/ollama_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/openrouter_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/openrouter_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/policy.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/probe_runner.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/process_runner.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/profiles.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/prompt.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/registry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/route_pool.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/route_pool_execution.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/schema_validation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/service.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/settings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/shadow.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/storage.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/telemetry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/worktree.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/zai_edit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/zai_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/routing/zai_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/savings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/systemd_unit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/ts_bridge.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/ts_resolver.mjs +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/typescript_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/validation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/watch.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/windows_job.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/windows_startup.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/src/graphite/windows_task.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/data/sqloracle/blindspots.py.txt +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/data/sqloracle/round69.py.txt +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/fake_clis/fake_cli.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/fixtures/provider_lifecycle_schema_v1.sql +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v2_ca77600.sql +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v3_94eb333.sql +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/fixtures/routing_schema_v4_lifecycle_migration.sql +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test__win32_ctypes.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_activation_backstop.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_agent_hook_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_agent_hooks.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_agent_hooks_session_books.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_agent_settings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_answer_contract.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_arrow_and_constructor_binding.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ast_make_id_length.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ast_name_a_module_only_imports.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ast_source_lines.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ast_super_over_a_builtin_base.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_atomic_write.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_bootstrap.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_build_detach.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_buildlock.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cache_engine_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cache_entry_pruning.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cache_file_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cache_file_set.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cache_pruning.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_call_graph.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_case_ambiguous_answer.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_attribution.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_cli.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_core.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_kind.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_lock.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_log_integrity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_mcp.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_register.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_report.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_channel_status.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_class_field_arrow_binding.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_below_repository_root.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_build_missing_path.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_channel.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_channel_attribution.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_doctor_below_root.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_reference.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_usage.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cli_version.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cluster.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_compare_dist.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_configuration_reference.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_context.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_context_builder.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cwd_relative_config.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_cycle_search.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_build_lock.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_child_lock.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_engine_staleness.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_health.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_health_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_launch.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_daemon_service_cli.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_debt.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_dependency_install.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_destructured_binding.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_determinism.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_dispatch_evidence.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_doctor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_doctor_agent_hooks.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_doctor_hooks.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_doctor_managed_docs.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_doctor_probes.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_documentation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_edit_apply.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_engine_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_exit_codes_reference.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_external_calls.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_file_node_id_collision.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_git_security.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_go_rust.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_graph_io.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_graph_provider_isolation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_hardening.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_health.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_hook_entry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_hook_template.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_hookinstall.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_hookshim.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_html_security.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_incident_ledger.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_init.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_init_activation_doctrine.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_init_hooks.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_init_validation_exit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_launchd_agent.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_lifecycle_operator.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_listing.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_listing_surfaces.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_llm.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_llm_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_mcp.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_mcp_server.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_mcp_server_channel_attribution.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_member_call_receiver.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_method_dispatch_scope.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_monorepo.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_mutation_tests.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_natural_query.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_no_path_is_graded.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_node_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ollama_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_overlays.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_path_leak_fixture.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_probe_diagnostics.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_probe_process.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_probe_workspace.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_process_contracts.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_programs.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_claude_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_codex_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_lifecycle.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_lifecycle_service.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_lifecycle_storage.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_observer.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_ollama_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_openrouter_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_provider_probe_runner.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_public_surface.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_published_schemas.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_pyscope.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_pyscopeoracle.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_builtin_named_symbols.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_import_bindings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_inherits_edge.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_local_alias_call.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_reexport_follow.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_resolver.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_python_scope_identity.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_query_plan.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_reliability.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_replacement_audit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_repository_root_ownership.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_resolve.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_resolve_python_reexports_of.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_review.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_route_pool.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_route_pool_execution.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_approval.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_benchmark.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_classifier.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_claude_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_cli.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_cli_contracts.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_cli_recovery.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_codex_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_context.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_contracts.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_diff_policy.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_openrouter_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_policy.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_process_runner.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_profiles.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_registry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_schema_validation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_security.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_service.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_shadow.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_storage.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_telemetry.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_worktree.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_zai_executor.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_routing_zai_probe.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_savings.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_search.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_self_super_dispatch.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_smoke.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_sqloracle.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_synthetic_repo.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_systemd_unit.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_ts_bridge.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_typescript_activation.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_typescript_resolver.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_usage_ledger.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_verify_artifact.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_verify_published_release.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_watch.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_windows_startup.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_windows_task.py +0 -0
- {graphite_code-1.4.1 → graphite_code-1.5.0}/tests/test_zai_edit.py +0 -0
|
@@ -15,6 +15,73 @@ 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
|
+
|
|
18
85
|
## [1.4.1] — 2026-10-25
|
|
19
86
|
|
|
20
87
|
A patch release: three fixes, two to the Python graph (#106, #107) and one
|
|
@@ -35,8 +102,9 @@ deployed 1.4.0 engine, with the same interpreter, from one tree:
|
|
|
35
102
|
constructor (#106). `calls` goes from 16,265 to 16,251 edges, and the
|
|
36
103
|
Python `calls` ratio from 0.978 to 0.983: 12,236 of 12,452 call sites
|
|
37
104
|
are bound, where 12,191 of 12,466 were;
|
|
38
|
-
- `contains`
|
|
39
|
-
|
|
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;
|
|
40
108
|
- `analysis` lists 18 cycles where it listed 20: the two it no longer lists
|
|
41
109
|
ran through those edges. Entry points, god nodes, orphans, surprising
|
|
42
110
|
connections and top files are identical; the community count goes from
|
|
@@ -131,7 +199,9 @@ deployed 1.3.0 engine, with the same interpreter, from one tree:
|
|
|
131
199
|
ended at a placeholder named for the local: 16 now end at a definition,
|
|
132
200
|
and 5 at a placeholder for a name the module only imports, which is where
|
|
133
201
|
a direct call of it already ended (#90; that gap is #107). One call site is
|
|
134
|
-
new (#85). `contains`
|
|
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
|
|
135
205
|
25,177 of the 25,230 edge triples are unchanged;
|
|
136
206
|
- the Python `calls` ratio goes from 0.976 to 0.978: 12,001 of 12,276 call
|
|
137
207
|
sites are bound, where 11,984 of 12,275 were;
|
|
@@ -251,8 +321,10 @@ one tree:
|
|
|
251
321
|
- all 9,031 node ids survive, each naming the same definition, file or
|
|
252
322
|
placeholder, and none is new;
|
|
253
323
|
- `calls` goes from 15,811 to 15,771: 44 call triples are gone and 4 are
|
|
254
|
-
new. `contains`
|
|
255
|
-
|
|
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;
|
|
256
328
|
- `analysis` (20 cycles, entry points, god nodes, orphans) is identical. The
|
|
257
329
|
community count goes from 169 to 170;
|
|
258
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.
|
|
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.
|
|
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.
|
|
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.
|
|
41
|
+
__version__ = "1.5.0"
|
|
@@ -1348,6 +1348,21 @@ def _entries_between(path: Path, start: int, end: int) -> list[dict[str, Any]]:
|
|
|
1348
1348
|
return entries
|
|
1349
1349
|
|
|
1350
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
|
+
|
|
1351
1366
|
def _cursor_number(value: Any, cast: type) -> Any:
|
|
1352
1367
|
"""Coerce a possibly-corrupted cursor field; non-numeric (or bool) -> 0.
|
|
1353
1368
|
|
|
@@ -1409,9 +1424,12 @@ def handle_stop(payload: dict[str, Any]) -> dict[str, Any] | None:
|
|
|
1409
1424
|
if not isinstance(offset, int) or offset > size or rotated:
|
|
1410
1425
|
offset = 0 # ledger rotated or cursor damaged; resync
|
|
1411
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)]
|
|
1412
1430
|
turn_tokens = 0
|
|
1413
1431
|
turn_seconds = 0.0
|
|
1414
|
-
for entry in
|
|
1432
|
+
for entry in own_entries:
|
|
1415
1433
|
est = savings_model.estimate_entry(entry)
|
|
1416
1434
|
turn_tokens += est["tokens_saved"]
|
|
1417
1435
|
turn_seconds += est["seconds_saved"]
|
|
@@ -1422,7 +1440,7 @@ def handle_stop(payload: dict[str, Any]) -> dict[str, Any] | None:
|
|
|
1422
1440
|
sessions[session_id] = state # re-insert -> newest position
|
|
1423
1441
|
_keep_newest_sessions(sessions)
|
|
1424
1442
|
usage_ledger.write_cursor(root, {"sessions": sessions})
|
|
1425
|
-
if not
|
|
1443
|
+
if not own_entries or not usage_ledger.savings_display_enabled(root):
|
|
1426
1444
|
return None
|
|
1427
1445
|
turn_text = savings_model.format_compact(turn_tokens, turn_seconds)
|
|
1428
1446
|
session_text = savings_model.format_compact(state["tokens"], state["seconds"])
|
|
@@ -20,6 +20,30 @@ MAX_FILES_PER_ENTRY = 100
|
|
|
20
20
|
_FILE_KEYS = frozenset({"source_file", "file", "path"})
|
|
21
21
|
_FILE_LIST_KEYS = frozenset({"impacted_files", "likely_tests", "files"})
|
|
22
22
|
|
|
23
|
+
# The session a process belongs to, looked for in this order: graphite's own
|
|
24
|
+
# name first, then the harness's. The first one that is set wins.
|
|
25
|
+
ENV_SESSION_ID = "GRAPHITE_SESSION_ID"
|
|
26
|
+
SESSION_ENV_VARS = (
|
|
27
|
+
ENV_SESSION_ID,
|
|
28
|
+
"CLAUDE_CODE_SESSION_ID",
|
|
29
|
+
"CODEX_COMPANION_SESSION_ID",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def current_session_id() -> str:
|
|
34
|
+
"""The session this process belongs to, or "" when it cannot know one.
|
|
35
|
+
|
|
36
|
+
The Stop hook's payload carries the session id, and the environment every
|
|
37
|
+
process the agent spawns carries the same string, so a command can record
|
|
38
|
+
which session made it. Where no variable is set -- a person at a
|
|
39
|
+
terminal -- the entry stays untagged and is counted as it was.
|
|
40
|
+
"""
|
|
41
|
+
for name in SESSION_ENV_VARS:
|
|
42
|
+
value = os.environ.get(name, "").strip()
|
|
43
|
+
if value:
|
|
44
|
+
return value
|
|
45
|
+
return ""
|
|
46
|
+
|
|
23
47
|
|
|
24
48
|
def local_dir(root: Path) -> Path:
|
|
25
49
|
return root / ".graphite" / "local"
|
|
@@ -94,6 +118,9 @@ def record_usage(root: Path, *, cmd: str, wall_ms: int, result: Any) -> None:
|
|
|
94
118
|
"output_bytes": output_bytes,
|
|
95
119
|
"files": collect_answer_files(result, root),
|
|
96
120
|
}
|
|
121
|
+
session = current_session_id()
|
|
122
|
+
if session:
|
|
123
|
+
entry["session"] = session
|
|
97
124
|
path = ledger_path(root)
|
|
98
125
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
99
126
|
if path.exists() and path.stat().st_size > MAX_LEDGER_BYTES:
|
|
@@ -17,7 +17,7 @@ from typing import Callable
|
|
|
17
17
|
|
|
18
18
|
import pytest
|
|
19
19
|
|
|
20
|
-
from graphite import activation
|
|
20
|
+
from graphite import activation, usage_ledger
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
# --- every sqlite connection this repo opens must be explicitly closed -------
|
|
@@ -118,6 +118,22 @@ def _isolate_activation_state(tmp_path_factory: pytest.TempPathFactory, monkeypa
|
|
|
118
118
|
return state
|
|
119
119
|
|
|
120
120
|
|
|
121
|
+
@pytest.fixture(autouse=True)
|
|
122
|
+
def _isolate_session_identity(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
123
|
+
"""No test may inherit the machine's own session identity.
|
|
124
|
+
|
|
125
|
+
A usage-ledger entry records the session that made it, read from the
|
|
126
|
+
environment (#110), and the Stop hook counts only the entries naming its
|
|
127
|
+
own session. A test that inherited this machine's session id would tag
|
|
128
|
+
its entries with it, and the hook -- which a test gives a made-up session
|
|
129
|
+
id -- would count none of them. The suite would then pass on a machine
|
|
130
|
+
whose environment carries no session and fail on one that does: a green
|
|
131
|
+
run that proved nothing on the machine that made it.
|
|
132
|
+
"""
|
|
133
|
+
for name in usage_ledger.SESSION_ENV_VARS:
|
|
134
|
+
monkeypatch.delenv(name, raising=False)
|
|
135
|
+
|
|
136
|
+
|
|
121
137
|
@pytest.fixture
|
|
122
138
|
def assert_json_omits() -> Callable[[object, object], None]:
|
|
123
139
|
"""Assert a needle appears nowhere in a JSON payload, escaped spelling included.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""A ledger entry carries the session that made it, so two sessions open in
|
|
2
|
+
one repository do not count each other's use (#110).
|
|
3
|
+
|
|
4
|
+
The usage ledger is per repository and every session appends to it. An entry
|
|
5
|
+
said nothing about who made it, so where two sessions were open at once each
|
|
6
|
+
one's Stop counted the other's queries as its own: the second session's Stop
|
|
7
|
+
saw the first's query, because that query was written after the second
|
|
8
|
+
session's books were opened, and the first session's next Stop saw the
|
|
9
|
+
second's.
|
|
10
|
+
|
|
11
|
+
The tag is what the process can know: `GRAPHITE_SESSION_ID` first, then the
|
|
12
|
+
harness's own variable. An entry no session can be attributed to is counted
|
|
13
|
+
as it was, so that no real use is dropped -- a person running graphite in a
|
|
14
|
+
terminal in the same repository is real use too.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
import pytest
|
|
21
|
+
|
|
22
|
+
from graphite import usage_ledger
|
|
23
|
+
from graphite.agent_hooks import handle_session_start, handle_stop
|
|
24
|
+
from graphite.savings import estimate_entry
|
|
25
|
+
from graphite.usage_ledger import iter_entries, read_cursor, record_usage
|
|
26
|
+
|
|
27
|
+
SESSION_VARS = ("GRAPHITE_SESSION_ID", "CLAUDE_CODE_SESSION_ID", "CODEX_COMPANION_SESSION_ID")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.fixture
|
|
31
|
+
def repo(tmp_path: Path) -> Path:
|
|
32
|
+
root = tmp_path / "repo"
|
|
33
|
+
(root / ".git").mkdir(parents=True)
|
|
34
|
+
(root / "alpha.py").write_text("def alpha():\n return 1\n" * 40, encoding="utf-8")
|
|
35
|
+
return root
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _event(root: Path, event: str, session: str) -> dict:
|
|
39
|
+
return {"session_id": session, "cwd": str(root), "hook_event_name": event}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _start(root: Path, session: str) -> None:
|
|
43
|
+
handle_session_start(_event(root, "SessionStart", session))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _stop(root: Path, session: str) -> dict | None:
|
|
47
|
+
return handle_stop(_event(root, "Stop", session))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _use(root: Path, monkeypatch: pytest.MonkeyPatch, session: str | None = None) -> None:
|
|
51
|
+
"""Record one use, as the named session (untagged when none is named)."""
|
|
52
|
+
if session is not None:
|
|
53
|
+
monkeypatch.setenv("GRAPHITE_SESSION_ID", session)
|
|
54
|
+
record_usage(root, cmd="context", wall_ms=50, result={"files": [{"path": "alpha.py"}]})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _one_entry_tokens(root: Path) -> int:
|
|
58
|
+
"""Every `_use` writes the same entry, so one entry's estimate is the unit."""
|
|
59
|
+
estimates = {estimate_entry(entry)["tokens_saved"] for entry in iter_entries(root)}
|
|
60
|
+
assert len(estimates) == 1 and estimates != {0}
|
|
61
|
+
return estimates.pop()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _session_tokens(root: Path, session: str) -> int:
|
|
65
|
+
return read_cursor(root)["sessions"][session]["tokens"]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_a_recorded_entry_carries_the_session_that_made_it(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
69
|
+
monkeypatch.setenv("GRAPHITE_SESSION_ID", "A")
|
|
70
|
+
|
|
71
|
+
_use(repo, monkeypatch, "A")
|
|
72
|
+
|
|
73
|
+
assert [entry.get("session") for entry in iter_entries(repo)] == ["A"]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_an_entry_no_session_can_name_carries_no_tag(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
77
|
+
_use(repo, monkeypatch)
|
|
78
|
+
|
|
79
|
+
assert "session" not in list(iter_entries(repo))[0]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_two_sessions_open_at_once_each_count_only_their_own_use(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
83
|
+
"""The reproduction from the issue, in the order it gives it."""
|
|
84
|
+
_start(repo, "A")
|
|
85
|
+
_start(repo, "B")
|
|
86
|
+
_use(repo, monkeypatch, "A")
|
|
87
|
+
assert _stop(repo, "A") is not None
|
|
88
|
+
_use(repo, monkeypatch, "B")
|
|
89
|
+
assert _stop(repo, "B") is not None
|
|
90
|
+
|
|
91
|
+
unit = _one_entry_tokens(repo)
|
|
92
|
+
assert _session_tokens(repo, "A") == unit
|
|
93
|
+
assert _session_tokens(repo, "B") == unit
|
|
94
|
+
|
|
95
|
+
# A has run nothing since its last Stop, so it has nothing to report.
|
|
96
|
+
assert _stop(repo, "A") is None
|
|
97
|
+
assert _session_tokens(repo, "A") == unit
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_a_session_total_holds_only_its_own_use(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
101
|
+
_start(repo, "A")
|
|
102
|
+
_start(repo, "B")
|
|
103
|
+
_use(repo, monkeypatch, "A")
|
|
104
|
+
_use(repo, monkeypatch, "A")
|
|
105
|
+
_use(repo, monkeypatch, "B")
|
|
106
|
+
_stop(repo, "A")
|
|
107
|
+
_stop(repo, "B")
|
|
108
|
+
|
|
109
|
+
unit = _one_entry_tokens(repo)
|
|
110
|
+
assert _session_tokens(repo, "A") == 2 * unit
|
|
111
|
+
assert _session_tokens(repo, "B") == unit
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_a_session_that_used_nothing_stays_silent_while_another_ran(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
115
|
+
_start(repo, "A")
|
|
116
|
+
_use(repo, monkeypatch, "B")
|
|
117
|
+
|
|
118
|
+
assert _stop(repo, "A") is None
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_an_entry_no_session_can_name_is_counted_for_every_session(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
122
|
+
"""A person running graphite in a terminal in the same repository is real
|
|
123
|
+
use, and dropping it would understate what the graph saved."""
|
|
124
|
+
_start(repo, "A")
|
|
125
|
+
_start(repo, "B")
|
|
126
|
+
_use(repo, monkeypatch)
|
|
127
|
+
assert _stop(repo, "A") is not None
|
|
128
|
+
assert _stop(repo, "B") is not None
|
|
129
|
+
|
|
130
|
+
unit = _one_entry_tokens(repo)
|
|
131
|
+
assert _session_tokens(repo, "A") == unit
|
|
132
|
+
assert _session_tokens(repo, "B") == unit
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_the_session_id_comes_from_graphite_session_id_first(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
136
|
+
monkeypatch.setenv("GRAPHITE_SESSION_ID", "g")
|
|
137
|
+
monkeypatch.setenv("CLAUDE_CODE_SESSION_ID", "c")
|
|
138
|
+
monkeypatch.setenv("CODEX_COMPANION_SESSION_ID", "x")
|
|
139
|
+
|
|
140
|
+
assert usage_ledger.current_session_id() == "g"
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_the_session_id_falls_back_to_the_harness_variable(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
144
|
+
monkeypatch.setenv("CLAUDE_CODE_SESSION_ID", "c")
|
|
145
|
+
monkeypatch.setenv("CODEX_COMPANION_SESSION_ID", "x")
|
|
146
|
+
|
|
147
|
+
assert usage_ledger.current_session_id() == "c"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_the_session_id_falls_back_to_the_companion_variable(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
151
|
+
monkeypatch.setenv("CODEX_COMPANION_SESSION_ID", "x")
|
|
152
|
+
|
|
153
|
+
assert usage_ledger.current_session_id() == "x"
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def test_no_session_id_is_reported_when_the_environment_has_none(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
157
|
+
assert usage_ledger.current_session_id() == ""
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_a_command_run_by_a_session_is_tagged_with_that_session(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys) -> None:
|
|
161
|
+
"""End to end: the command records the entry, and the entry knows who ran it."""
|
|
162
|
+
from graphite.cli import main
|
|
163
|
+
|
|
164
|
+
(tmp_path / "alpha.py").write_text("def target_symbol():\n return 1\n", encoding="utf-8")
|
|
165
|
+
monkeypatch.chdir(tmp_path)
|
|
166
|
+
assert main(["build", "."]) == 0
|
|
167
|
+
monkeypatch.setenv("GRAPHITE_SESSION_ID", "A")
|
|
168
|
+
|
|
169
|
+
assert main(["search", "target_symbol"]) == 0
|
|
170
|
+
capsys.readouterr()
|
|
171
|
+
|
|
172
|
+
assert [entry.get("session") for entry in iter_entries(tmp_path)] == ["A"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|