agent-tokenops 1.1.0__tar.gz → 2.0.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 (152) hide show
  1. {agent_tokenops-1.1.0/src/agent_tokenops.egg-info → agent_tokenops-2.0.0}/PKG-INFO +1 -2
  2. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/README.md +0 -1
  3. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/pyproject.toml +1 -1
  4. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0/src/agent_tokenops.egg-info}/PKG-INFO +1 -2
  5. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/agent_tokenops.egg-info/SOURCES.txt +0 -35
  6. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/_version.py +1 -1
  7. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/chronicle_trace_utils.py +1 -1
  8. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/run.py +0 -5
  9. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/stream_wrapper.py +2 -3
  10. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/config/default.yaml +1 -1
  11. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/__init__.py +0 -8
  12. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/attribution.py +0 -5
  13. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/context.py +0 -10
  14. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/engine.py +2 -1
  15. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/ledger_backend.py +0 -4
  16. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/models.py +0 -5
  17. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_layering.py +5 -16
  18. agent_tokenops-1.1.0/src/tokenops/capabilities/integration.py +0 -20
  19. agent_tokenops-1.1.0/src/tokenops/control/__init__.py +0 -152
  20. agent_tokenops-1.1.0/src/tokenops/control/attribution.py +0 -13
  21. agent_tokenops-1.1.0/src/tokenops/control/boundary.py +0 -13
  22. agent_tokenops-1.1.0/src/tokenops/control/chronicle_trace_utils.py +0 -13
  23. agent_tokenops-1.1.0/src/tokenops/control/config.py +0 -13
  24. agent_tokenops-1.1.0/src/tokenops/control/context.py +0 -13
  25. agent_tokenops-1.1.0/src/tokenops/control/core.py +0 -13
  26. agent_tokenops-1.1.0/src/tokenops/control/crossing.py +0 -13
  27. agent_tokenops-1.1.0/src/tokenops/control/engine.py +0 -13
  28. agent_tokenops-1.1.0/src/tokenops/control/http.py +0 -13
  29. agent_tokenops-1.1.0/src/tokenops/control/instrument.py +0 -13
  30. agent_tokenops-1.1.0/src/tokenops/control/integration.py +0 -13
  31. agent_tokenops-1.1.0/src/tokenops/control/ledger.py +0 -13
  32. agent_tokenops-1.1.0/src/tokenops/control/ledger_writers.py +0 -13
  33. agent_tokenops-1.1.0/src/tokenops/control/models.py +0 -13
  34. agent_tokenops-1.1.0/src/tokenops/control/policies/__init__.py +0 -12
  35. agent_tokenops-1.1.0/src/tokenops/control/policies/_util.py +0 -13
  36. agent_tokenops-1.1.0/src/tokenops/control/policies/concurrency_cap.py +0 -13
  37. agent_tokenops-1.1.0/src/tokenops/control/policies/context_compaction.py +0 -13
  38. agent_tokenops-1.1.0/src/tokenops/control/policies/cost_budget.py +0 -13
  39. agent_tokenops-1.1.0/src/tokenops/control/policies/cost_guard.py +0 -13
  40. agent_tokenops-1.1.0/src/tokenops/control/policies/output_runaway.py +0 -13
  41. agent_tokenops-1.1.0/src/tokenops/control/policies/pre_call_worst_case.py +0 -13
  42. agent_tokenops-1.1.0/src/tokenops/control/policies/progress_guard.py +0 -13
  43. agent_tokenops-1.1.0/src/tokenops/control/policies/step_cap.py +0 -13
  44. agent_tokenops-1.1.0/src/tokenops/control/policies/time_budget.py +0 -13
  45. agent_tokenops-1.1.0/src/tokenops/control/policies/tool_fix.py +0 -13
  46. agent_tokenops-1.1.0/src/tokenops/control/policies/tool_output_cap.py +0 -13
  47. agent_tokenops-1.1.0/src/tokenops/control/policy_labels.py +0 -13
  48. agent_tokenops-1.1.0/src/tokenops/control/pricing.py +0 -13
  49. agent_tokenops-1.1.0/src/tokenops/control/request_context.py +0 -13
  50. agent_tokenops-1.1.0/src/tokenops/control/run.py +0 -13
  51. agent_tokenops-1.1.0/src/tokenops/control/usage.py +0 -13
  52. agent_tokenops-1.1.0/tests/test_deprecated_names.py +0 -75
  53. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/LICENSE.txt +0 -0
  54. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/setup.cfg +0 -0
  55. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/agent_tokenops.egg-info/dependency_links.txt +0 -0
  56. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/agent_tokenops.egg-info/requires.txt +0 -0
  57. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/agent_tokenops.egg-info/top_level.txt +0 -0
  58. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/__init__.py +0 -0
  59. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/adapters/__init__.py +0 -0
  60. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/adapters/langchain.py +0 -0
  61. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/__init__.py +0 -0
  62. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/complete_wrapper.py +0 -0
  63. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/crossing.py +0 -0
  64. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/ledger_writers.py +0 -0
  65. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/capabilities/step_observation.py +0 -0
  66. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/config/__init__.py +0 -0
  67. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/config/loader.py +0 -0
  68. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/demo.py +0 -0
  69. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/env.py +0 -0
  70. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/boundary.py +0 -0
  71. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/budget.py +0 -0
  72. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/config.py +0 -0
  73. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/core.py +0 -0
  74. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/ledger.py +0 -0
  75. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/ledger_events.py +0 -0
  76. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/ledger_types.py +0 -0
  77. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/message_steering.py +0 -0
  78. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/observation_utils.py +0 -0
  79. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/__init__.py +0 -0
  80. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/_util.py +0 -0
  81. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/concurrency_cap.py +0 -0
  82. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/context_compaction.py +0 -0
  83. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/cost_budget.py +0 -0
  84. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/cost_guard.py +0 -0
  85. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/output_runaway.py +0 -0
  86. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/pre_call_worst_case.py +0 -0
  87. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/progress_guard.py +0 -0
  88. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/step_cap.py +0 -0
  89. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/time_budget.py +0 -0
  90. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/tool_fix.py +0 -0
  91. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policies/tool_output_cap.py +0 -0
  92. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/policy_labels.py +0 -0
  93. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/pricing.py +0 -0
  94. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/request_context.py +0 -0
  95. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/framework/usage.py +0 -0
  96. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/interfaces/__init__.py +0 -0
  97. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/interfaces/http.py +0 -0
  98. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/interfaces/instrument.py +0 -0
  99. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/providers/__init__.py +0 -0
  100. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/providers/anthropic.py +0 -0
  101. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/providers/factory.py +0 -0
  102. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/providers/openai.py +0 -0
  103. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/providers/types.py +0 -0
  104. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/py.typed +0 -0
  105. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/repositories/__init__.py +0 -0
  106. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/repositories/control_plane_client.py +0 -0
  107. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/repositories/control_plane_errors.py +0 -0
  108. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/repositories/control_plane_types.py +0 -0
  109. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/src/tokenops/repositories/ledger_event_writer.py +0 -0
  110. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_a2a_health.py +0 -0
  111. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_a2a_server_errors.py +0 -0
  112. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_actuators.py +0 -0
  113. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_apply.py +0 -0
  114. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_async_ledger.py +0 -0
  115. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_attribution.py +0 -0
  116. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_attribution_ledger_policies_e2e.py +0 -0
  117. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_boundary.py +0 -0
  118. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_chronicle_boundary.py +0 -0
  119. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_compaction_metadata.py +0 -0
  120. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_concurrency_cap.py +0 -0
  121. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_config.py +0 -0
  122. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_context_compaction.py +0 -0
  123. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_cost_budget.py +0 -0
  124. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_cost_guard.py +0 -0
  125. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_cross_process_budget_gating.py +0 -0
  126. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_crossing_hook.py +0 -0
  127. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_demo.py +0 -0
  128. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_governance_event_names.py +0 -0
  129. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_httpx_instrumentation.py +0 -0
  130. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_integration.py +0 -0
  131. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_ledger.py +0 -0
  132. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_llm_boundary_precall.py +0 -0
  133. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_output_runaway.py +0 -0
  134. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_policies_wrap_integration.py +0 -0
  135. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_policy_coordination.py +0 -0
  136. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_policy_names.py +0 -0
  137. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_pre_call_worst_case.py +0 -0
  138. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_preview_mode.py +0 -0
  139. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_pricing.py +0 -0
  140. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_progress_guard.py +0 -0
  141. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_provider_usage.py +0 -0
  142. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_reason_encoding.py +0 -0
  143. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_repositories_control_plane_client.py +0 -0
  144. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_repositories_ledger_event_writer.py +0 -0
  145. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_step_cap.py +0 -0
  146. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_thread_safety.py +0 -0
  147. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_time_budget.py +0 -0
  148. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_tokenops_run.py +0 -0
  149. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_tool_fix.py +0 -0
  150. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_tool_output_cap.py +0 -0
  151. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_wrap_adapters.py +0 -0
  152. {agent_tokenops-1.1.0 → agent_tokenops-2.0.0}/tests/test_wrap_complete_chronicle.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-tokenops
3
- Version: 1.1.0
3
+ Version: 2.0.0
4
4
  Summary: Run-aware token governance for agents: budgets, policies and halts on Chronicle and the AgentPlane control plane
5
5
  Author: Susheem Koul, Tisha Chawla
6
6
  License-Expression: MIT
@@ -290,7 +290,6 @@ src/tokenops/ # installable package
290
290
  ├── framework/ # in-process machinery: ledger, policies, pricing, governor (no network)
291
291
  ├── capabilities/ # tokenops_run, wrap_complete, the Chronicle hook
292
292
  ├── interfaces/ # instrument_app, HTTP error mapping
293
- ├── control/ # deprecated import shims (removed in 2.0)
294
293
  ├── repositories/ # the control-plane client and the background ledger writer
295
294
  ├── providers/ # OpenAI / Anthropic complete dispatch
296
295
  └── config/ # packaged default governance
@@ -249,7 +249,6 @@ src/tokenops/ # installable package
249
249
  ├── framework/ # in-process machinery: ledger, policies, pricing, governor (no network)
250
250
  ├── capabilities/ # tokenops_run, wrap_complete, the Chronicle hook
251
251
  ├── interfaces/ # instrument_app, HTTP error mapping
252
- ├── control/ # deprecated import shims (removed in 2.0)
253
252
  ├── repositories/ # the control-plane client and the background ledger writer
254
253
  ├── providers/ # OpenAI / Anthropic complete dispatch
255
254
  └── config/ # packaged default governance
@@ -129,7 +129,7 @@ module = [
129
129
  ]
130
130
  follow_imports = "skip"
131
131
 
132
- # The layered packages are held to `mypy --strict`; `tokenops.control` is only deprecated shims.
132
+ # The layered packages are held to `mypy --strict`.
133
133
  [[tool.mypy.overrides]]
134
134
  module = [
135
135
  "tokenops.framework",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-tokenops
3
- Version: 1.1.0
3
+ Version: 2.0.0
4
4
  Summary: Run-aware token governance for agents: budgets, policies and halts on Chronicle and the AgentPlane control plane
5
5
  Author: Susheem Koul, Tisha Chawla
6
6
  License-Expression: MIT
@@ -290,7 +290,6 @@ src/tokenops/ # installable package
290
290
  ├── framework/ # in-process machinery: ledger, policies, pricing, governor (no network)
291
291
  ├── capabilities/ # tokenops_run, wrap_complete, the Chronicle hook
292
292
  ├── interfaces/ # instrument_app, HTTP error mapping
293
- ├── control/ # deprecated import shims (removed in 2.0)
294
293
  ├── repositories/ # the control-plane client and the background ledger writer
295
294
  ├── providers/ # OpenAI / Anthropic complete dispatch
296
295
  └── config/ # packaged default governance
@@ -17,7 +17,6 @@ src/tokenops/capabilities/__init__.py
17
17
  src/tokenops/capabilities/chronicle_trace_utils.py
18
18
  src/tokenops/capabilities/complete_wrapper.py
19
19
  src/tokenops/capabilities/crossing.py
20
- src/tokenops/capabilities/integration.py
21
20
  src/tokenops/capabilities/ledger_writers.py
22
21
  src/tokenops/capabilities/run.py
23
22
  src/tokenops/capabilities/step_observation.py
@@ -25,39 +24,6 @@ src/tokenops/capabilities/stream_wrapper.py
25
24
  src/tokenops/config/__init__.py
26
25
  src/tokenops/config/default.yaml
27
26
  src/tokenops/config/loader.py
28
- src/tokenops/control/__init__.py
29
- src/tokenops/control/attribution.py
30
- src/tokenops/control/boundary.py
31
- src/tokenops/control/chronicle_trace_utils.py
32
- src/tokenops/control/config.py
33
- src/tokenops/control/context.py
34
- src/tokenops/control/core.py
35
- src/tokenops/control/crossing.py
36
- src/tokenops/control/engine.py
37
- src/tokenops/control/http.py
38
- src/tokenops/control/instrument.py
39
- src/tokenops/control/integration.py
40
- src/tokenops/control/ledger.py
41
- src/tokenops/control/ledger_writers.py
42
- src/tokenops/control/models.py
43
- src/tokenops/control/policy_labels.py
44
- src/tokenops/control/pricing.py
45
- src/tokenops/control/request_context.py
46
- src/tokenops/control/run.py
47
- src/tokenops/control/usage.py
48
- src/tokenops/control/policies/__init__.py
49
- src/tokenops/control/policies/_util.py
50
- src/tokenops/control/policies/concurrency_cap.py
51
- src/tokenops/control/policies/context_compaction.py
52
- src/tokenops/control/policies/cost_budget.py
53
- src/tokenops/control/policies/cost_guard.py
54
- src/tokenops/control/policies/output_runaway.py
55
- src/tokenops/control/policies/pre_call_worst_case.py
56
- src/tokenops/control/policies/progress_guard.py
57
- src/tokenops/control/policies/step_cap.py
58
- src/tokenops/control/policies/time_budget.py
59
- src/tokenops/control/policies/tool_fix.py
60
- src/tokenops/control/policies/tool_output_cap.py
61
27
  src/tokenops/framework/__init__.py
62
28
  src/tokenops/framework/attribution.py
63
29
  src/tokenops/framework/boundary.py
@@ -121,7 +87,6 @@ tests/test_cost_guard.py
121
87
  tests/test_cross_process_budget_gating.py
122
88
  tests/test_crossing_hook.py
123
89
  tests/test_demo.py
124
- tests/test_deprecated_names.py
125
90
  tests/test_governance_event_names.py
126
91
  tests/test_httpx_instrumentation.py
127
92
  tests/test_integration.py
@@ -1,3 +1,3 @@
1
1
  """Single source of the package version (read by the build backend and at runtime)."""
2
2
 
3
- __version__ = "1.1.0"
3
+ __version__ = "2.0.0"
@@ -2,7 +2,7 @@
2
2
 
3
3
  A run is a Chronicle trace: its only identifier is ``trace_id``. A hop arrives with the
4
4
  caller's ``traceparent`` and joins that trace; the entry hop starts a new one. This module is
5
- the single place that reads the active Chronicle span, so the rest of ``tokenops.control``
5
+ the single place that reads the active Chronicle span, so the rest of TokenOps
6
6
  never touches Chronicle's session.
7
7
 
8
8
  ``chronicle.current_session`` (Chronicle 1.1) reads the active session without opening one;
@@ -61,11 +61,6 @@ class TokenOpsBound:
61
61
  controls: ApplyControls | PreviewControls
62
62
  client: ControlPlaneClient | None
63
63
 
64
- @property
65
- def registration(self) -> HopAttribution:
66
- """Deprecated alias of ``hop``."""
67
- return self.hop
68
-
69
64
 
70
65
  def _resolve_ambient(
71
66
  *,
@@ -8,6 +8,7 @@ tighter) or INJECT. There is no HALT here: the breakers backstop any hard stop.
8
8
 
9
9
  from __future__ import annotations
10
10
 
11
+ import contextlib
11
12
  from collections.abc import Callable
12
13
  from dataclasses import dataclass
13
14
  from typing import Any
@@ -70,10 +71,8 @@ def _stream_and_watch(
70
71
  gen.close() # CANCEL: hard-break the stream
71
72
  break
72
73
  finally:
73
- try:
74
+ with contextlib.suppress(Exception): # already closed or finished
74
75
  gen.close()
75
- except Exception:
76
- pass
77
76
  return cancelled, "".join(acc)
78
77
 
79
78
 
@@ -1,4 +1,4 @@
1
- # TokenOps control plane seed. Consumed by tokenops.control.build_governor / Store auto-seed.
1
+ # TokenOps control plane seed. Consumed by tokenops.framework.build_governor / Store auto-seed.
2
2
  # Budgets are spend caps bound to a segment; policies are the (detect, fix) templates.
3
3
  # Policy keys are canonical IDs, not display labels or instance IDs. See docs/product/policies-index.md.
4
4
  governance:
@@ -12,9 +12,7 @@ runtime vocabulary.
12
12
 
13
13
  from tokenops.framework.attribution import (
14
14
  merge_hop_dims,
15
- merge_registration_dims,
16
15
  require_hop,
17
- require_registration,
18
16
  )
19
17
  from tokenops.framework.boundary import emit_observation, observation_from_crossing
20
18
  from tokenops.framework.config import build_governance_stack, build_governor
@@ -56,8 +54,6 @@ from tokenops.framework.models import (
56
54
  GovernanceMode,
57
55
  HopAttribution,
58
56
  NoGovernanceScopeError,
59
- RunNotRegisteredError,
60
- RunRegistration,
61
57
  parse_governance_mode,
62
58
  )
63
59
  from tokenops.framework.request_context import (
@@ -97,8 +93,6 @@ __all__ = [
97
93
  "PreviewControls",
98
94
  "RaiseControls",
99
95
  "RequestContext",
100
- "RunNotRegisteredError",
101
- "RunRegistration",
102
96
  "Severity",
103
97
  "Signal",
104
98
  "SpanContext",
@@ -113,10 +107,8 @@ __all__ = [
113
107
  "governance_events_payload",
114
108
  "halt_detector_from_events",
115
109
  "merge_hop_dims",
116
- "merge_registration_dims",
117
110
  "observation_from_crossing",
118
111
  "parse_governance_mode",
119
112
  "require_hop",
120
- "require_registration",
121
113
  "segment_key",
122
114
  ]
@@ -57,8 +57,3 @@ def require_hop() -> HopAttribution:
57
57
  "no governed scope in this context: wrap the work in tokenops_run"
58
58
  )
59
59
  return reg
60
-
61
-
62
- # Deprecated names kept for 1.x.
63
- require_registration = require_hop
64
- merge_registration_dims = merge_hop_dims
@@ -30,11 +30,6 @@ class BoundRun:
30
30
  hop: HopAttribution
31
31
  span: SpanContext
32
32
 
33
- @property
34
- def registration(self) -> HopAttribution:
35
- """Deprecated alias of ``hop``."""
36
- return self.hop
37
-
38
33
 
39
34
  _hop: ContextVar[HopAttribution | None] = ContextVar("tokenops_hop", default=None)
40
35
  _span: ContextVar[SpanContext | None] = ContextVar("run_span", default=None)
@@ -125,8 +120,3 @@ def run_scope(hop: HopAttribution, span: SpanContext) -> Iterator[BoundRun]:
125
120
  finally:
126
121
  _hop.reset(tok_reg)
127
122
  _span.reset(tok_span)
128
-
129
-
130
- # Deprecated names kept for 1.x.
131
- current_registration = current_hop
132
- bind_registration = bind_hop
@@ -65,7 +65,8 @@ class AgentControls(Protocol):
65
65
  """Connector OUT — the single channel the control plane uses to act on a run. One
66
66
  method, polymorphic on ``action.kind``; adding an ActionKind never changes it."""
67
67
 
68
- def apply(self, action: Action) -> None: ...
68
+ def apply(self, action: Action) -> None:
69
+ """Carry out one governance action on the run."""
69
70
 
70
71
 
71
72
  class RaiseControls:
@@ -25,11 +25,9 @@ class LedgerBackend(Protocol):
25
25
 
26
26
  def precheck(self, request: PrecheckRequest) -> PrecheckResult:
27
27
  """Read halt, spend and in-flight state for one trace."""
28
- ...
29
28
 
30
29
  def apply_events(self, events: list[LedgerEvent]) -> ApplyResult:
31
30
  """Apply a batch of ledger events in order, once."""
32
- ...
33
31
 
34
32
 
35
33
  class LedgerWriter(Protocol):
@@ -37,8 +35,6 @@ class LedgerWriter(Protocol):
37
35
 
38
36
  def submit(self, events: Sequence[LedgerEvent]) -> int:
39
37
  """Queue events; return how many were accepted."""
40
- ...
41
38
 
42
39
  def flush(self, timeout: float = 5.0) -> bool:
43
40
  """Wait until queued events are sent or dropped (``False`` on timeout)."""
44
- ...
@@ -48,8 +48,3 @@ class HopAttribution:
48
48
 
49
49
  class NoGovernanceScopeError(LookupError):
50
50
  """Telemetry was produced outside a bound ``tokenops_run`` scope."""
51
-
52
-
53
- # Deprecated names kept for 1.x; use HopAttribution and NoGovernanceScopeError.
54
- RunRegistration = HopAttribution
55
- RunNotRegisteredError = NoGovernanceScopeError
@@ -1,8 +1,7 @@
1
1
  """The layers import only downwards (AGENTS.md: Layers).
2
2
 
3
3
  framework -> repositories -> capabilities -> interfaces. The framework does no I/O, so it must
4
- not see the control-plane client; ``tokenops.control`` is only deprecated shims and nothing in
5
- the package may depend on it.
4
+ not see the control-plane client.
6
5
  """
7
6
 
8
7
  from __future__ import annotations
@@ -16,10 +15,10 @@ SRC = Path(__file__).resolve().parent.parent / "src" / "tokenops"
16
15
 
17
16
  #: layer -> the tokenops packages it must NOT import
18
17
  FORBIDDEN = {
19
- "framework": ("repositories", "capabilities", "interfaces", "control"),
20
- "repositories": ("capabilities", "interfaces", "control"),
21
- "capabilities": ("interfaces", "control"),
22
- "interfaces": ("control",),
18
+ "framework": ("repositories", "capabilities", "interfaces"),
19
+ "repositories": ("capabilities", "interfaces"),
20
+ "capabilities": ("interfaces",),
21
+ "interfaces": (),
23
22
  }
24
23
 
25
24
 
@@ -51,16 +50,6 @@ def test_a_layer_imports_only_the_layers_below_it(layer: str) -> None:
51
50
  assert not offenders, "\n".join(offenders)
52
51
 
53
52
 
54
- def test_nothing_outside_the_deprecated_package_imports_tokenops_control() -> None:
55
- offenders = []
56
- for path in sorted(SRC.rglob("*.py")):
57
- if path.relative_to(SRC).parts[0] == "control":
58
- continue
59
- if "control" in _tokenops_imports(path):
60
- offenders.append(str(path.relative_to(SRC)))
61
- assert not offenders, offenders
62
-
63
-
64
53
  def test_the_framework_package_has_no_network_client() -> None:
65
54
  """No ``httpx`` (or any HTTP client) in the framework: I/O lives in repositories."""
66
55
  for path in sorted((SRC / "framework").rglob("*.py")):
@@ -1,20 +0,0 @@
1
- """The in-process integration surface in one place (the 1.0 module, kept for its import path).
2
-
3
- The pieces live in :mod:`tokenops.capabilities.step_observation`,
4
- :mod:`tokenops.capabilities.complete_wrapper`, :mod:`tokenops.capabilities.stream_wrapper` and
5
- :mod:`tokenops.framework.message_steering`.
6
- """
7
-
8
- from tokenops.capabilities.complete_wrapper import wrap_complete
9
- from tokenops.capabilities.step_observation import make_on_step, step_to_observation
10
- from tokenops.capabilities.stream_wrapper import wrap_stream
11
- from tokenops.framework.message_steering import apply_carry_to_messages, consume_carry
12
-
13
- __all__ = [
14
- "apply_carry_to_messages",
15
- "consume_carry",
16
- "make_on_step",
17
- "step_to_observation",
18
- "wrap_complete",
19
- "wrap_stream",
20
- ]
@@ -1,152 +0,0 @@
1
- """Deprecated: ``tokenops.control`` was split into layers in 1.1.
2
-
3
- The names below still import from here and are the same objects as before. Import them from
4
- :mod:`tokenops.framework` (vocabulary, ledger, policies, governor), :mod:`tokenops.capabilities`
5
- (``tokenops_run``, ``wrap_complete``, the crossing hook), :mod:`tokenops.interfaces` (HTTP) or
6
- :mod:`tokenops.repositories` (the control-plane client), or from :mod:`tokenops` itself. The old
7
- paths are removed in 2.0.
8
- """
9
-
10
- import warnings
11
-
12
- from tokenops.capabilities import (
13
- TokenOpsBound,
14
- agentplane_run_scope,
15
- apply_carry_to_messages,
16
- consume_carry,
17
- flush_ledger_writes,
18
- install_crossing_hook,
19
- make_on_step,
20
- on_crossing,
21
- step_to_observation,
22
- tokenops_run,
23
- wrap_complete,
24
- wrap_stream,
25
- )
26
- from tokenops.framework import (
27
- Action,
28
- ActionKind,
29
- AgentControls,
30
- ApplyControls,
31
- ApplyResult,
32
- Attribution,
33
- BoundaryStep,
34
- Budget,
35
- CallRequest,
36
- Detector,
37
- GovernanceContext,
38
- GovernanceMode,
39
- Governor,
40
- Halt,
41
- HopAttribution,
42
- Ledger,
43
- LedgerEvent,
44
- LedgerView,
45
- LocalRunState,
46
- NoGovernanceScopeError,
47
- Observation,
48
- Policy,
49
- PrecheckRequest,
50
- PrecheckResult,
51
- PreviewControls,
52
- RaiseControls,
53
- RequestContext,
54
- RunNotRegisteredError,
55
- RunRegistration,
56
- Severity,
57
- Signal,
58
- SpanContext,
59
- Throttled,
60
- Usage,
61
- bind_request_context,
62
- build_governance_stack,
63
- build_governor,
64
- clear_request_context,
65
- current_request_context,
66
- emit_observation,
67
- governance_events_payload,
68
- halt_detector_from_events,
69
- merge_hop_dims,
70
- merge_registration_dims,
71
- observation_from_crossing,
72
- parse_governance_mode,
73
- require_hop,
74
- require_registration,
75
- segment_key,
76
- )
77
- from tokenops.interfaces import instrument_app, with_governance_errors
78
- from tokenops.repositories import ControlPlaneClient
79
-
80
- warnings.warn(
81
- "tokenops.control is deprecated and will be removed in 2.0; import from tokenops, "
82
- "tokenops.framework, tokenops.capabilities, tokenops.interfaces or tokenops.repositories",
83
- DeprecationWarning,
84
- stacklevel=2,
85
- )
86
-
87
- __all__ = [
88
- "Action",
89
- "ActionKind",
90
- "AgentControls",
91
- "ApplyControls",
92
- "ApplyResult",
93
- "Attribution",
94
- "BoundaryStep",
95
- "Budget",
96
- "CallRequest",
97
- "ControlPlaneClient",
98
- "Detector",
99
- "GovernanceContext",
100
- "GovernanceMode",
101
- "Governor",
102
- "Halt",
103
- "HopAttribution",
104
- "Ledger",
105
- "LedgerEvent",
106
- "LedgerView",
107
- "LocalRunState",
108
- "NoGovernanceScopeError",
109
- "Observation",
110
- "Policy",
111
- "PrecheckRequest",
112
- "PrecheckResult",
113
- "PreviewControls",
114
- "RaiseControls",
115
- "RequestContext",
116
- "RunNotRegisteredError",
117
- "RunRegistration",
118
- "Severity",
119
- "Signal",
120
- "SpanContext",
121
- "Throttled",
122
- "TokenOpsBound",
123
- "Usage",
124
- "agentplane_run_scope",
125
- "apply_carry_to_messages",
126
- "bind_request_context",
127
- "build_governance_stack",
128
- "build_governor",
129
- "clear_request_context",
130
- "consume_carry",
131
- "current_request_context",
132
- "emit_observation",
133
- "flush_ledger_writes",
134
- "governance_events_payload",
135
- "halt_detector_from_events",
136
- "install_crossing_hook",
137
- "instrument_app",
138
- "make_on_step",
139
- "merge_hop_dims",
140
- "merge_registration_dims",
141
- "observation_from_crossing",
142
- "on_crossing",
143
- "parse_governance_mode",
144
- "require_hop",
145
- "require_registration",
146
- "segment_key",
147
- "step_to_observation",
148
- "tokenops_run",
149
- "with_governance_errors",
150
- "wrap_complete",
151
- "wrap_stream",
152
- ]
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.attribution``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import attribution as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.attribution moved to tokenops.framework.attribution; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.boundary``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import boundary as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.boundary moved to tokenops.framework.boundary; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.capabilities.chronicle_trace_utils``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.capabilities import chronicle_trace_utils as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.chronicle_trace_utils moved to tokenops.capabilities.chronicle_trace_utils; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.config``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import config as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.config moved to tokenops.framework.config; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.context``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import context as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.context moved to tokenops.framework.context; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.core``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import core as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.core moved to tokenops.framework.core; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.capabilities.crossing``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.capabilities import crossing as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.crossing moved to tokenops.capabilities.crossing; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.framework.engine``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.framework import engine as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.engine moved to tokenops.framework.engine; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.interfaces.http``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.interfaces import http as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.http moved to tokenops.interfaces.http; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.interfaces.instrument``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.interfaces import instrument as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.instrument moved to tokenops.interfaces.instrument; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module
@@ -1,13 +0,0 @@
1
- """Deprecated: this module moved to ``tokenops.capabilities.integration``."""
2
-
3
- import sys
4
- import warnings
5
-
6
- from tokenops.capabilities import integration as _module
7
-
8
- warnings.warn(
9
- "tokenops.control.integration moved to tokenops.capabilities.integration; the old path is deprecated and will be removed in 2.0",
10
- DeprecationWarning,
11
- stacklevel=2,
12
- )
13
- sys.modules[__name__] = _module