agentenv-framework-protocol 0.1.668__tar.gz → 0.1.669__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 (267) hide show
  1. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/PKG-INFO +16 -8
  2. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/README.md +15 -7
  3. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/pyproject.toml +1 -1
  4. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/__init__.py +14 -0
  5. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/proxy.py +8 -4
  6. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/tasks/v1.py +110 -16
  7. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_proxy.py +4 -1
  8. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_usage.py +53 -1
  9. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/.gitignore +0 -0
  10. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/LICENSE +0 -0
  11. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/NOTICE +0 -0
  12. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/THIRD_PARTY_NOTICES.md +0 -0
  13. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/__init__.py +0 -0
  14. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/advanced_agent.py +0 -0
  15. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/basic_agent.py +0 -0
  16. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/custom_extensions_agent.py +0 -0
  17. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/multimodal_agent.py +0 -0
  18. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/reference_model.py +0 -0
  19. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/streaming_agent.py +0 -0
  20. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/.gitignore +0 -0
  21. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/Dockerfile +0 -0
  22. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/Dockerfile.dockerignore +0 -0
  23. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/README.md +0 -0
  24. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/data/seed.json +0 -0
  25. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/env.toml +0 -0
  26. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/site.py +0 -0
  27. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/index.html +0 -0
  28. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/package-lock.json +0 -0
  29. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/package.json +0 -0
  30. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/src/main.js +0 -0
  31. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/src/style.css +0 -0
  32. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/vite.config.js +0 -0
  33. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/__init__.py +0 -0
  34. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_atif_copy.py +0 -0
  35. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_media_spool.py +0 -0
  36. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_secrets.py +0 -0
  37. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_snapshot_state.py +0 -0
  38. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
  39. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  40. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_turn_index.py +0 -0
  41. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/clock.py +0 -0
  42. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/control_token.py +0 -0
  43. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
  44. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
  45. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  46. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  47. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  48. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  49. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/agent_env_environment.py +0 -0
  50. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/PROFILE.md +0 -0
  51. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/__init__.py +0 -0
  52. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/__main__.py +0 -0
  53. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/_image_size.py +0 -0
  54. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/adapter.py +0 -0
  55. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/builder.py +0 -0
  56. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/coding.json +0 -0
  57. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/coding.stripped.json +0 -0
  58. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/computer_use.json +0 -0
  59. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/late_result.json +0 -0
  60. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/482405b002a62efa8516c36709a7a100637507670576fa73a20ad5420d55c66f.png +0 -0
  61. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/55c64d0fcd6f9d5f7c828093857e3fdfda68478bb4e9bd24d481ef391c7804e8.heic +0 -0
  62. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/67905ad3cc2dd52b1f5f6a6d2814de0396618b29b4238b9af5207aeb69936e6d.mp4 +0 -0
  63. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/69a8aa01fe5537076d023dd5e9cc4275b39fc0434aa6483a9f58b66ef2f3c896.png +0 -0
  64. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/82e60066a2de261b6653bcdda90d1cb9a7af2f474cecd82e8d371e8384d72315.png +0 -0
  65. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/845e91831319e89c4d656bdb80c278ac09a7230d61e5dfd2e1b1fbb436ac8917.pdf +0 -0
  66. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/multi_agent.json +0 -0
  67. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/odd_parts.json +0 -0
  68. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/subagent.json +0 -0
  69. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/two_turns.json +0 -0
  70. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/kit.py +0 -0
  71. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/LICENSE +0 -0
  72. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/VENDORED.md +0 -0
  73. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/__init__.py +0 -0
  74. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/agent.py +0 -0
  75. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/content.py +0 -0
  76. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/final_metrics.py +0 -0
  77. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/metrics.py +0 -0
  78. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/observation.py +0 -0
  79. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/observation_result.py +0 -0
  80. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/step.py +0 -0
  81. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/subagent_trajectory_ref.py +0 -0
  82. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/tool_call.py +0 -0
  83. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/trajectory.py +0 -0
  84. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/profile.py +0 -0
  85. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/reader.py +0 -0
  86. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/runner.py +0 -0
  87. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/served.py +0 -0
  88. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/validator.py +0 -0
  89. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/client.py +0 -0
  90. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/__init__.py +0 -0
  91. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_adb.py +0 -0
  92. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_declare.py +0 -0
  93. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_desktop.py +0 -0
  94. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_job.py +0 -0
  95. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_linux.py +0 -0
  96. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_load.py +0 -0
  97. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_macos.py +0 -0
  98. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_reaping.py +0 -0
  99. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  100. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  101. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_windows.py +0 -0
  102. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  103. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_x11.py +0 -0
  104. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/annotate.py +0 -0
  105. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app.py +0 -0
  106. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app_data.py +0 -0
  107. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  108. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/apps.py +0 -0
  109. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/card.py +0 -0
  110. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/checks.py +0 -0
  111. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/clock.py +0 -0
  112. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  113. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  114. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  115. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  116. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  117. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  118. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  119. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  120. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  121. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  122. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/dataplane.py +0 -0
  123. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/driver.py +0 -0
  124. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/errors.py +0 -0
  125. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/extensions.py +0 -0
  126. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/frames.py +0 -0
  127. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/keys.py +0 -0
  128. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/launch.py +0 -0
  129. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/manifest.py +0 -0
  130. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/operations.py +0 -0
  131. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/platform.py +0 -0
  132. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/prefix.py +0 -0
  133. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/queue.py +0 -0
  134. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/recording.py +0 -0
  135. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/results.py +0 -0
  136. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  137. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/runtime.py +0 -0
  138. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/seed.py +0 -0
  139. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/serve.py +0 -0
  140. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/serve_app.py +0 -0
  141. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/served.py +0 -0
  142. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/session.py +0 -0
  143. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/settings.py +0 -0
  144. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/skill.py +0 -0
  145. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/spaces.py +0 -0
  146. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/svc.py +0 -0
  147. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/tools.py +0 -0
  148. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/errors.py +0 -0
  149. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/manifest.py +0 -0
  150. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/passthrough.py +0 -0
  151. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/preflight.py +0 -0
  152. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_access.py +0 -0
  153. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_client.py +0 -0
  154. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_context.py +0 -0
  155. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/transfers.py +0 -0
  156. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/types.py +0 -0
  157. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/__init__.py +0 -0
  158. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/clock.py +0 -0
  159. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/conformance.py +0 -0
  160. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/environment.py +0 -0
  161. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/errors.py +0 -0
  162. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/forwarding.py +0 -0
  163. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/readiness.py +0 -0
  164. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/routes.py +0 -0
  165. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/session.py +0 -0
  166. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  167. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/cdp.py +0 -0
  168. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/contexts.py +0 -0
  169. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/control.py +0 -0
  170. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/data.py +0 -0
  171. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/devtools.py +0 -0
  172. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/environment.py +0 -0
  173. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/log.py +0 -0
  174. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/network.py +0 -0
  175. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/recording.py +0 -0
  176. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/scope.py +0 -0
  177. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  178. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/stream.py +0 -0
  179. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/atif_cases.py +0 -0
  180. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/computer_fake.py +0 -0
  181. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/conftest.py +0 -0
  182. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/fake_adb.py +0 -0
  183. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/probe_fake.py +0 -0
  184. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent.py +0 -0
  185. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent_clock.py +0 -0
  186. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent_examples.py +0 -0
  187. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_media.py +0 -0
  188. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_prescribe.py +0 -0
  189. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_scrubbing.py +0 -0
  190. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_serving.py +0 -0
  191. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_turns.py +0 -0
  192. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_cdp_config.py +0 -0
  193. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_object_transfers.py +0 -0
  194. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_peer_agents.py +0 -0
  195. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_staging.py +0 -0
  196. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_trajectory_log.py +0 -0
  197. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_agent_env_environment.py +0 -0
  198. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_builder.py +0 -0
  199. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_fixtures.py +0 -0
  200. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_kit.py +0 -0
  201. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_profile.py +0 -0
  202. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_reader.py +0 -0
  203. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_validator.py +0 -0
  204. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_atif_vendored.py +0 -0
  205. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_cdp.py +0 -0
  206. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_contexts.py +0 -0
  207. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_data.py +0 -0
  208. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_log.py +0 -0
  209. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_network.py +0 -0
  210. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_recording.py +0 -0
  211. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_browser_state.py +0 -0
  212. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_client.py +0 -0
  213. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_app_data.py +0 -0
  214. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_app_server.py +0 -0
  215. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_beside.py +0 -0
  216. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_clock.py +0 -0
  217. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance.py +0 -0
  218. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_attempts.py +0 -0
  219. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_checks.py +0 -0
  220. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_page.py +0 -0
  221. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_recording.py +0 -0
  222. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_dataplane.py +0 -0
  223. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_declare.py +0 -0
  224. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_driver.py +0 -0
  225. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_driver_keys.py +0 -0
  226. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_extensions.py +0 -0
  227. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_frames.py +0 -0
  228. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_macos.py +0 -0
  229. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_page.py +0 -0
  230. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_queue.py +0 -0
  231. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_recording.py +0 -0
  232. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_recording_annotate.py +0 -0
  233. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_screenshot_delay.py +0 -0
  234. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_seed.py +0 -0
  235. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_serve.py +0 -0
  236. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_served.py +0 -0
  237. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_session_windows.py +0 -0
  238. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_spaces.py +0 -0
  239. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_svc_forward.py +0 -0
  240. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_tool_prefix.py +0 -0
  241. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_computer_windows_driver.py +0 -0
  242. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_control_token.py +0 -0
  243. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_data_objects.py +0 -0
  244. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_devtools_pipe.py +0 -0
  245. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_errors.py +0 -0
  246. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_extension_methods.py +0 -0
  247. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_intake.py +0 -0
  248. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_manifest.py +0 -0
  249. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_preflight.py +0 -0
  250. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_rpc_keepalive.py +0 -0
  251. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_access.py +0 -0
  252. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_annotations.py +0 -0
  253. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_client.py +0 -0
  254. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context.py +0 -0
  255. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context_fastmcp.py +0 -0
  256. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context_injection.py +0 -0
  257. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_tool_defers.py +0 -0
  258. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_usage_models.py +0 -0
  259. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_api.py +0 -0
  260. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_browser.py +0 -0
  261. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_conformance.py +0 -0
  262. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_environment.py +0 -0
  263. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_forwarding.py +0 -0
  264. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_live.py +0 -0
  265. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_mcp.py +0 -0
  266. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_notes_example.py +0 -0
  267. {agentenv_framework_protocol-0.1.668 → agentenv_framework_protocol-0.1.669}/tests/test_website_readiness.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentenv-framework-protocol
3
- Version: 0.1.668
3
+ Version: 0.1.669
4
4
  Summary: Open data-plane protocol and server SDK for agent environments.
5
5
  Project-URL: Homepage, https://www.agentenvframework.com
6
6
  Project-URL: Documentation, https://www.agentenvframework.com/docs
@@ -1575,8 +1575,12 @@ cannot drift.
1575
1575
  `cache_read_tokens` and `cache_write_tokens`, and `input_includes_cache`, which
1576
1576
  says whether `input_tokens` counts both cache counts (`True`), neither
1577
1577
  (`False`), or is unknown (`None`, the default). Set the flag whenever you set
1578
- the cache counts: a price can't read them without it. Runtime-specific counts go
1579
- in `provider_details`, but cache counts go in their own fields. `Usage.from_dict`
1578
+ the cache counts: a price can't read them without it. `cache_write_ttl_tokens`
1579
+ counts the cache writes by how long they were kept, by a time of one unit
1580
+ (`{"5m": 200, "1h": 300}`; `s`, `m`, `h` or `d`), which a price charges at each
1581
+ time's rate; writes it doesn't count are taken as kept the provider's default
1582
+ time. Runtime-specific counts go in `provider_details`, but cache counts go in
1583
+ their own fields. `Usage.from_dict`
1580
1584
  reads what `to_dict` wrote under any protocol version, a field it leaves out
1581
1585
  being `None` and a key it doesn't know ignored, and `TaskResult.failure(...,
1582
1586
  usage=...)` carries usage on a failure as `success` does.
@@ -1584,7 +1588,8 @@ usage=...)` carries usage on a failure as `success` does.
1584
1588
  An agent that knows each call's model gives a turn's counts by model in
1585
1589
  `Usage.models`, on every turn: one `ModelUsage` per model, with the model's
1586
1590
  name as called, its `calls`, its token and cache counts read as `Usage`'s are,
1587
- and the agent's own `cost_usd` for them when it has one. That prices a
1591
+ its cache writes by time when the agent knows them, and the agent's own
1592
+ `cost_usd` for them when it has one. That prices a
1588
1593
  subagent on a smaller model, a side call for a title, or a whole turn a CLI
1589
1594
  ran on another model at that model's own rate. The rows cover every call the
1590
1595
  turn counted; a call the agent can't name goes under the model it was
@@ -1602,10 +1607,13 @@ and Responses (`input_tokens`) shapes and Anthropic's:
1602
1607
  - Anthropic's `input_tokens` counts neither `cache_read_input_tokens` nor
1603
1608
  `cache_creation_input_tokens`, and neither does the `prompt_tokens` a LiteLLM
1604
1609
  proxy sends with those two beside it, so they're added, to `total_tokens` too.
1605
- - A provider's split of its cache writes by how long they're kept, priced apart
1606
- (Anthropic's `cache_creation`, OpenAI's `cache_write_tokens_details`), is kept
1607
- in `provider_details`, and so are the keys of a usage in none of these shapes,
1608
- as `unrecognized`. A value that isn't a count is left out.
1610
+ - A provider's split of its cache writes by how long they're kept (Anthropic's
1611
+ `cache_creation`, OpenAI's `cache_write_tokens_details`) is kept in
1612
+ `provider_details` and read into `cache_write_ttl_tokens`, by the time each
1613
+ count's name holds (`ephemeral_1h_input_tokens`, `ttl_12h_tokens`); so are the
1614
+ keys of a usage in none of these shapes, as `unrecognized`. A value that isn't
1615
+ a count is left out. A `Usage` built or read without `cache_write_ttl_tokens`
1616
+ takes it from such a split in its `provider_details`, else from its rows.
1609
1617
 
1610
1618
  Through a gateway, whether a response's input counts the cache depends on the
1611
1619
  model behind it: a LiteLLM proxy's Claude answers through Chat Completions leave
@@ -1504,8 +1504,12 @@ cannot drift.
1504
1504
  `cache_read_tokens` and `cache_write_tokens`, and `input_includes_cache`, which
1505
1505
  says whether `input_tokens` counts both cache counts (`True`), neither
1506
1506
  (`False`), or is unknown (`None`, the default). Set the flag whenever you set
1507
- the cache counts: a price can't read them without it. Runtime-specific counts go
1508
- in `provider_details`, but cache counts go in their own fields. `Usage.from_dict`
1507
+ the cache counts: a price can't read them without it. `cache_write_ttl_tokens`
1508
+ counts the cache writes by how long they were kept, by a time of one unit
1509
+ (`{"5m": 200, "1h": 300}`; `s`, `m`, `h` or `d`), which a price charges at each
1510
+ time's rate; writes it doesn't count are taken as kept the provider's default
1511
+ time. Runtime-specific counts go in `provider_details`, but cache counts go in
1512
+ their own fields. `Usage.from_dict`
1509
1513
  reads what `to_dict` wrote under any protocol version, a field it leaves out
1510
1514
  being `None` and a key it doesn't know ignored, and `TaskResult.failure(...,
1511
1515
  usage=...)` carries usage on a failure as `success` does.
@@ -1513,7 +1517,8 @@ usage=...)` carries usage on a failure as `success` does.
1513
1517
  An agent that knows each call's model gives a turn's counts by model in
1514
1518
  `Usage.models`, on every turn: one `ModelUsage` per model, with the model's
1515
1519
  name as called, its `calls`, its token and cache counts read as `Usage`'s are,
1516
- and the agent's own `cost_usd` for them when it has one. That prices a
1520
+ its cache writes by time when the agent knows them, and the agent's own
1521
+ `cost_usd` for them when it has one. That prices a
1517
1522
  subagent on a smaller model, a side call for a title, or a whole turn a CLI
1518
1523
  ran on another model at that model's own rate. The rows cover every call the
1519
1524
  turn counted; a call the agent can't name goes under the model it was
@@ -1531,10 +1536,13 @@ and Responses (`input_tokens`) shapes and Anthropic's:
1531
1536
  - Anthropic's `input_tokens` counts neither `cache_read_input_tokens` nor
1532
1537
  `cache_creation_input_tokens`, and neither does the `prompt_tokens` a LiteLLM
1533
1538
  proxy sends with those two beside it, so they're added, to `total_tokens` too.
1534
- - A provider's split of its cache writes by how long they're kept, priced apart
1535
- (Anthropic's `cache_creation`, OpenAI's `cache_write_tokens_details`), is kept
1536
- in `provider_details`, and so are the keys of a usage in none of these shapes,
1537
- as `unrecognized`. A value that isn't a count is left out.
1539
+ - A provider's split of its cache writes by how long they're kept (Anthropic's
1540
+ `cache_creation`, OpenAI's `cache_write_tokens_details`) is kept in
1541
+ `provider_details` and read into `cache_write_ttl_tokens`, by the time each
1542
+ count's name holds (`ephemeral_1h_input_tokens`, `ttl_12h_tokens`); so are the
1543
+ keys of a usage in none of these shapes, as `unrecognized`. A value that isn't
1544
+ a count is left out. A `Usage` built or read without `cache_write_ttl_tokens`
1545
+ takes it from such a split in its `provider_details`, else from its rows.
1538
1546
 
1539
1547
  Through a gateway, whether a response's input counts the cache depends on the
1540
1548
  model behind it: a LiteLLM proxy's Claude answers through Chat Completions leave
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentenv-framework-protocol"
3
- version = "0.1.668"
3
+ version = "0.1.669"
4
4
  description = "Open data-plane protocol and server SDK for agent environments."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -135,6 +135,13 @@ from .tasks.v1 import (
135
135
  ModelUsage,
136
136
  Usage,
137
137
  WriteOnly,
138
+ TOKEN_COUNTS,
139
+ TTL_UNIT_PATTERN,
140
+ TTL_UNITS,
141
+ ttl_counts_in_seconds,
142
+ ttl_label,
143
+ ttl_seconds,
144
+ ttl_sum,
138
145
  )
139
146
  from ..transfers import (
140
147
  HttpGetGrant,
@@ -277,6 +284,13 @@ __all__ = [
277
284
  "Uploaded",
278
285
  "ModelUsage",
279
286
  "Usage",
287
+ "TOKEN_COUNTS",
288
+ "TTL_UNIT_PATTERN",
289
+ "TTL_UNITS",
290
+ "ttl_counts_in_seconds",
291
+ "ttl_label",
292
+ "ttl_seconds",
293
+ "ttl_sum",
280
294
  "WriteNamespaceGrant",
281
295
  "WriteObject",
282
296
  "WriteOnly",
@@ -19,7 +19,7 @@ import shutil
19
19
  import signal
20
20
  from collections import defaultdict
21
21
  from collections.abc import AsyncIterator, Mapping
22
- from dataclasses import dataclass, field, fields, replace
22
+ from dataclasses import dataclass, field, replace
23
23
  from datetime import datetime, timezone
24
24
  from pathlib import Path
25
25
  from typing import Any
@@ -58,7 +58,9 @@ from .extensions import (
58
58
  extension,
59
59
  )
60
60
  from .framework import AgentEnvAgent, AgentIdentity, a2a_agent
61
- from .tasks.v1 import AgentConfig, ModelUsage, TaskRequest, TaskResult, TextPart, TrajectoryLog, Usage
61
+ from .tasks.v1 import (
62
+ TOKEN_COUNTS, AgentConfig, ModelUsage, TaskRequest, TaskResult, TextPart, TrajectoryLog, Usage, ttl_sum,
63
+ )
62
64
  from ..tool_client import ToolResult, ToolSession, ToolSessionError
63
65
  from ..transfers import download
64
66
  from ..types import EnvironmentTool
@@ -522,7 +524,7 @@ def _tool_error(message: str) -> ProxyToolResult:
522
524
  return ProxyToolResult(content=[{"type": "text", "text": f"error: {message}"}], is_error=True)
523
525
 
524
526
 
525
- _USAGE_SUMS = (*(f.name for f in fields(Usage) if f.name.endswith("_tokens")), "cost_usd")
527
+ _USAGE_SUMS = (*TOKEN_COUNTS, "cost_usd")
526
528
  # Each provider's split of its cache writes by how long they're kept, which ``Usage.from_model_response`` keeps.
527
529
  _CACHE_WRITE_SPLITS = ("cache_creation", "cache_write_tokens_details")
528
530
 
@@ -560,7 +562,8 @@ def _turn_usage(turn: _Turn) -> Usage:
560
562
  as the lower bound it is; how many had cache counts with no word on whether their input held them
561
563
  (``cache_unsettled``), which leaves the turn's flag unknown; how many usages were in a shape none of the readers
562
564
  know (``unrecognized``); and each provider's split of the cache writes, summed, a reported ``Usage``'s split
563
- counted only where it holds counts, as its ``provider_details`` may hold anything."""
565
+ counted only where it holds counts, as its ``provider_details`` may hold anything. Its writes by how long they
566
+ were kept are the calls' summed."""
564
567
  calls = [usage for _, usage in turn.model_calls]
565
568
  sums, unreported = {}, {}
566
569
  for name in _USAGE_SUMS:
@@ -581,6 +584,7 @@ def _turn_usage(turn: _Turn) -> Usage:
581
584
  **({"cache_unsettled": unsettled} if unsettled else {}),
582
585
  **({"unrecognized": unrecognized} if unrecognized else {}), **splits}
583
586
  return Usage(tool_call_count=len(turn.actions), **sums,
587
+ cache_write_ttl_tokens=ttl_sum(call.cache_write_ttl_tokens for call in calls),
584
588
  input_includes_cache=True if sums["input_tokens"] is not None and not unsettled else None,
585
589
  models=_by_model(turn), provider_details=details if calls else {})
586
590
 
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  import json
12
12
  import logging
13
+ import re
13
14
  from collections.abc import AsyncIterator, Awaitable, Iterable, Mapping
14
15
  from dataclasses import dataclass, field, fields
15
16
  from enum import Enum
@@ -364,14 +365,9 @@ class NativeTrajectory:
364
365
  object.__setattr__(self, "payload", _copy_json_value(self.payload))
365
366
 
366
367
 
367
- _USAGE_COUNTERS = (
368
- "tool_call_count",
369
- "input_tokens",
370
- "output_tokens",
371
- "total_tokens",
372
- "cache_read_tokens",
373
- "cache_write_tokens",
374
- )
368
+ #: ``Usage``'s token counts, each an integer a turn's calls sum.
369
+ TOKEN_COUNTS = ("input_tokens", "output_tokens", "total_tokens", "cache_read_tokens", "cache_write_tokens")
370
+ _USAGE_COUNTERS = ("tool_call_count", *TOKEN_COUNTS)
375
371
 
376
372
 
377
373
  # The keys a model response's usage is read by, in any of the shapes ``Usage.from_model_response`` reads.
@@ -385,6 +381,86 @@ def _count(value: Any) -> int | None:
385
381
  return value if isinstance(value, int) and not isinstance(value, bool) and value >= 0 else None
386
382
 
387
383
 
384
+ #: The seconds in each unit a time a cache write was kept may be written in, however it's spelled.
385
+ TTL_UNITS = {"s": 1, "sec": 1, "m": 60, "min": 60, "h": 3600, "hr": 3600, "hour": 3600, "d": 86400, "day": 86400}
386
+ #: A pattern for any of ``TTL_UNITS``' spellings, the longest first so a pattern that ends there matches it whole.
387
+ TTL_UNIT_PATTERN = "|".join(sorted(TTL_UNITS, key=len, reverse=True))
388
+ # How long cache writes were kept, as ``cache_write_ttl_tokens`` names it: a count of one unit, ``5m``, ``1h``, ``90s``.
389
+ _TTL_LABEL = re.compile(r"^(\d+)([smhd])$")
390
+ # A provider's count of cache writes kept a while, named for the time: Anthropic's ``ephemeral_1h_input_tokens``,
391
+ # OpenAI's ``ttl_12h_tokens``.
392
+ _TTL_COUNT = re.compile(rf"^(?:ephemeral_|ttl_)?(\d+)({TTL_UNIT_PATTERN})(?:_input)?_tokens$")
393
+ #: Where ``Usage.from_model_response`` keeps each provider's split of its cache writes by how long they were kept.
394
+ CACHE_WRITE_SPLITS = ("cache_creation", "cache_write_tokens_details")
395
+
396
+
397
+ _Time = TypeVar("_Time", str, int)
398
+
399
+
400
+ def ttl_seconds(label: Any) -> int | None:
401
+ """The seconds a ``cache_write_ttl_tokens`` label names, ``1h`` as 3600; None for one that names no time."""
402
+ match = _TTL_LABEL.match(label) if isinstance(label, str) else None
403
+ return int(match[1]) * TTL_UNITS[match[2]] if match and int(match[1]) > 0 else None
404
+
405
+
406
+ def ttl_label(seconds: int) -> str:
407
+ """A time as ``cache_write_ttl_tokens`` names it, in the largest unit it's a whole number of: ``1h``, ``90m``,
408
+ ``1d``, ``45s``."""
409
+ for unit, size in (("d", 86400), ("h", 3600), ("m", 60)):
410
+ if seconds % size == 0:
411
+ return f"{seconds // size}{unit}"
412
+ return f"{seconds}s"
413
+
414
+
415
+ def _ttl_counts(value: Any) -> dict[str, int] | None:
416
+ """A ``cache_write_ttl_tokens`` value with each time named as ``ttl_label`` names it; raises for a key that names no
417
+ time or a count that isn't a non-negative integer."""
418
+ if value is None:
419
+ return None
420
+ if not isinstance(value, Mapping):
421
+ raise TypeError("cache_write_ttl_tokens must map times to counts")
422
+ counts: dict[str, int] = {}
423
+ for label, count in value.items():
424
+ if (seconds := ttl_seconds(label)) is None:
425
+ raise ValueError(f"cache_write_ttl_tokens: {label!r} names no time, as 5m or 1h do")
426
+ if _count(count) is None:
427
+ raise ValueError(f"cache_write_ttl_tokens: {label}'s count must be a non-negative integer")
428
+ counts[ttl_label(seconds)] = counts.get(ttl_label(seconds), 0) + count
429
+ return counts
430
+
431
+
432
+ def _ttl_from_splits(details: Mapping[str, Any]) -> dict[str, int] | None:
433
+ """The writes by time a provider's split in ``details`` (``CACHE_WRITE_SPLITS``) counts, by each count's name; a
434
+ count that isn't a positive integer is left out, and None when none is left."""
435
+ counts: dict[str, int] = {}
436
+ for name in CACHE_WRITE_SPLITS:
437
+ split = details.get(name)
438
+ for key, value in split.items() if isinstance(split, Mapping) else ():
439
+ if (match := _TTL_COUNT.match(str(key))) and (count := _count(value)):
440
+ label = ttl_label(int(match[1]) * TTL_UNITS[match[2]])
441
+ counts[label] = counts.get(label, 0) + count
442
+ return counts or None
443
+
444
+
445
+ def ttl_sum(parts: Iterable[Mapping[_Time, int] | None]) -> dict[_Time, int] | None:
446
+ """Counts by how long cache writes were kept (``cache_write_ttl_tokens``, by label or by seconds) summed by time;
447
+ None when none of ``parts`` gives one."""
448
+ total: dict[_Time, int] = {}
449
+ for part in parts:
450
+ for time, count in (part or {}).items():
451
+ total[time] = total.get(time, 0) + count
452
+ return total or None
453
+
454
+
455
+ def ttl_counts_in_seconds(value: Any) -> dict[int, int]:
456
+ """A ``cache_write_ttl_tokens`` value as stored, by seconds, each time that can't be read or count that isn't a
457
+ positive integer left out, as a reader of records another version wrote must take them."""
458
+ if not isinstance(value, Mapping):
459
+ return {}
460
+ return ttl_sum({seconds: count} for label, count in value.items()
461
+ if (seconds := ttl_seconds(label)) is not None and _count(count)) or {}
462
+
463
+
388
464
  def _check_counts(record: Any, names: Iterable[str]) -> None:
389
465
  for name in names:
390
466
  value = getattr(record, name)
@@ -414,11 +490,13 @@ class ModelUsage:
414
490
  cache_write_tokens: int | None = None
415
491
  input_includes_cache: bool | None = None
416
492
  cost_usd: float | None = None
493
+ cache_write_ttl_tokens: Mapping[str, int] | None = None
417
494
 
418
495
  def __post_init__(self) -> None:
419
496
  if not isinstance(self.model, str) or not self.model:
420
497
  raise ValueError("a model's usage must name the model")
421
498
  _check_counts(self, _MODEL_COUNTERS)
499
+ object.__setattr__(self, "cache_write_ttl_tokens", _ttl_counts(self.cache_write_ttl_tokens))
422
500
 
423
501
  @classmethod
424
502
  def of(cls, model: str, usages: Iterable["Usage"]) -> "ModelUsage":
@@ -435,7 +513,8 @@ class ModelUsage:
435
513
  flags = {usage.input_includes_cache for usage in usages if usage.input_tokens is not None}
436
514
  return cls(model=model, calls=len(usages), **{name: total(name) for name in _MODEL_COUNTERS[1:]},
437
515
  input_includes_cache=flags.pop() if len(flags) == 1 else None,
438
- cost_usd=sum(costs) if costs and None not in costs else None)
516
+ cost_usd=sum(costs) if costs and None not in costs else None,
517
+ cache_write_ttl_tokens=ttl_sum(usage.cache_write_ttl_tokens for usage in usages))
439
518
 
440
519
  @classmethod
441
520
  def from_dict(cls, data: Mapping[str, Any]) -> "ModelUsage":
@@ -445,7 +524,8 @@ class ModelUsage:
445
524
  return cls(**{f.name: data[f.name] for f in fields(cls) if data.get(f.name) is not None})
446
525
 
447
526
  def to_dict(self) -> dict[str, Any]:
448
- return {f.name: value for f in fields(self) if (value := getattr(self, f.name)) is not None}
527
+ return {f.name: dict(value) if isinstance(value, Mapping) else value
528
+ for f in fields(self) if (value := getattr(self, f.name)) is not None}
449
529
 
450
530
 
451
531
  @dataclass(frozen=True, slots=True, kw_only=True)
@@ -455,7 +535,11 @@ class Usage:
455
535
  ``input_includes_cache`` says whether ``input_tokens`` counts both of them (True), neither (False), or is unknown
456
536
  (None), which a price needs to read the counts. ``models`` is the counts by model, from an agent that knows each
457
537
  call's model: it covers every call the turn counted, so a price can charge each model at its own rate. A count
458
- the turn leaves out that every row gives is the rows' sum, and so is the includes-cache flag the rows agree on."""
538
+ the turn leaves out that every row gives is the rows' sum, and so is the includes-cache flag the rows agree on.
539
+ ``cache_write_ttl_tokens`` is the cache writes by how long they were kept (``ttl_label``'s ``5m``, ``1h``, ``12h``),
540
+ which a price charges at each time's rate; left out, it's what a provider's split in ``provider_details``
541
+ (``CACHE_WRITE_SPLITS``) counts, else the rows' sum when every row gives one. Writes it doesn't count weren't
542
+ said how long they were kept."""
459
543
 
460
544
  tool_call_count: int | None = None
461
545
  input_tokens: int | None = None
@@ -463,6 +547,7 @@ class Usage:
463
547
  total_tokens: int | None = None
464
548
  cache_read_tokens: int | None = None
465
549
  cache_write_tokens: int | None = None
550
+ cache_write_ttl_tokens: Mapping[str, int] | None = None
466
551
  input_includes_cache: bool | None = None
467
552
  cost_usd: float | None = None
468
553
  models: tuple[ModelUsage, ...] = ()
@@ -486,6 +571,13 @@ class Usage:
486
571
  object.__setattr__(
487
572
  self, "provider_details", _copy_json_value(self.provider_details)
488
573
  )
574
+ rows = [model.cache_write_ttl_tokens for model in self.models]
575
+ ttl = _ttl_counts(self.cache_write_ttl_tokens)
576
+ if ttl is None:
577
+ ttl = _ttl_from_splits(self.provider_details)
578
+ if ttl is None and rows and None not in rows:
579
+ ttl = ttl_sum(rows)
580
+ object.__setattr__(self, "cache_write_ttl_tokens", ttl)
489
581
 
490
582
  @classmethod
491
583
  def from_dict(cls, data: Mapping[str, Any]) -> "Usage":
@@ -511,9 +603,10 @@ class Usage:
511
603
  ``cached_tokens`` it counts, and ``cache_write_tokens`` with them. Anthropic's ``input_tokens``, and the
512
604
  ``prompt_tokens`` a LiteLLM proxy sends with Anthropic's ``cache_read_input_tokens`` and
513
605
  ``cache_creation_input_tokens`` beside it, count neither, so they're added, to ``total_tokens`` too. A
514
- provider's split of its cache writes by how long they're kept (Anthropic's ``cache_creation``, OpenAI's
515
- ``cache_write_tokens_details``), priced apart, is kept in ``provider_details``; so are the keys of a usage
516
- in none of these shapes, as ``unrecognized``. A value that isn't a count is left out."""
606
+ provider's split of its cache writes by how long they're kept (Anthropic's ``cache_creation``, which a LiteLLM
607
+ client's ``cache_creation_token_details`` is kept as, and OpenAI's ``cache_write_tokens_details``) is kept in
608
+ ``provider_details``, and read into ``cache_write_ttl_tokens``; so are the keys of a usage in none of these
609
+ shapes, as ``unrecognized``. A value that isn't a count is left out."""
517
610
  key = "prompt_tokens" if "prompt_tokens" in usage else "input_tokens"
518
611
  details = usage.get(f"{key}_details")
519
612
  details = details if isinstance(details, Mapping) else {}
@@ -532,7 +625,7 @@ class Usage:
532
625
  total += missing
533
626
  elif input_tokens is not None and output is not None:
534
627
  total = input_tokens + output
535
- kept = {"cache_creation": usage.get("cache_creation"),
628
+ kept = {"cache_creation": usage.get("cache_creation") or details.get("cache_creation_token_details"),
536
629
  "cache_write_tokens_details": details.get("cache_write_tokens_details")}
537
630
  provider_details: dict[str, Any] = {
538
631
  name: counts for name, split in kept.items() if isinstance(split, Mapping)
@@ -549,7 +642,8 @@ class Usage:
549
642
  and not self.provider_details)
550
643
 
551
644
  def to_dict(self) -> dict[str, Any]:
552
- result = {name: value for name, value in self._values().items() if value is not None}
645
+ result = {name: dict(value) if isinstance(value, Mapping) else value
646
+ for name, value in self._values().items() if value is not None}
553
647
  if self.models:
554
648
  result["models"] = [model.to_dict() for model in self.models]
555
649
  if self.provider_details:
@@ -734,6 +734,7 @@ def test_a_reported_usages_cache_write_split_counts_only_where_it_holds_counts(c
734
734
  task = _settled(client, task_id)
735
735
  assert task["status"]["state"] == "completed"
736
736
  assert _usage(task)["provider_details"] == {"model_calls": 3, "cache_creation": {"ephemeral_5m_input_tokens": 7}}
737
+ assert _usage(task)["cache_write_ttl_tokens"] == {"5m": 7}
737
738
 
738
739
 
739
740
  def test_a_turn_sums_each_providers_cache_write_split_and_counts_usage_it_couldnt_read(client):
@@ -746,10 +747,12 @@ def test_a_turn_sums_each_providers_cache_write_split_and_counts_usage_it_couldn
746
747
  assert _proxy(client, "record", task_id=task_id, message="Thinking.", usage=usage).status_code == 200
747
748
  _proxy(client, "reply", task_id=task_id, parts=[{"kind": "text", "text": "Done."}])
748
749
 
749
- assert _usage(_settled(client, task_id))["provider_details"] == {
750
+ usage = _usage(_settled(client, task_id))
751
+ assert usage["provider_details"] == {
750
752
  "model_calls": 3, "unrecognized": 1,
751
753
  "unreported": {"input_tokens": 1, "output_tokens": 1, "total_tokens": 1, "cache_write_tokens": 1},
752
754
  "cache_creation": {"ephemeral_1h_input_tokens": 7813, "ephemeral_5m_input_tokens": 20}}
755
+ assert usage["cache_write_ttl_tokens"] == {"1h": 7813, "5m": 20}
753
756
 
754
757
 
755
758
  def test_an_env_tool_named_bash_is_held_to_all_its_recorded_arguments(terminal, monkeypatch, tmp_path):
@@ -3,7 +3,8 @@ set, read back by ``from_dict`` from any protocol version, and carried by a fail
3
3
 
4
4
  import pytest
5
5
 
6
- from agentenv_protocol.a2a_agent.tasks.v1 import TaskResult, Usage
6
+ from agentenv_protocol.a2a_agent import ttl_counts_in_seconds, ttl_label, ttl_seconds, ttl_sum
7
+ from agentenv_protocol.a2a_agent.tasks.v1 import ModelUsage, TaskResult, Usage
7
8
 
8
9
  FULL = Usage(tool_call_count=2, input_tokens=120, output_tokens=7, total_tokens=127, cache_read_tokens=100,
9
10
  cache_write_tokens=20, input_includes_cache=True, cost_usd=0.01, provider_details={"model": "m"})
@@ -118,6 +119,14 @@ RESPONSES = {
118
119
  "cache_creation_input_tokens": 0, "cache_read_input_tokens": 7809},
119
120
  Usage(input_tokens=7818, output_tokens=5, total_tokens=7823,
120
121
  cache_read_tokens=7809, cache_write_tokens=0, input_includes_cache=True)),
122
+ "litellm-client-claude-writes-for-an-hour": (
123
+ {"prompt_tokens": 7822, "completion_tokens": 5, "total_tokens": 7827, "cache_creation_input_tokens": 7813,
124
+ "cache_read_input_tokens": 0,
125
+ "prompt_tokens_details": {"cached_tokens": 0, "cache_creation_tokens": 7813, "cache_creation_token_details": {
126
+ "ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7813}}},
127
+ Usage(input_tokens=7822, output_tokens=5, total_tokens=7827, cache_read_tokens=0, cache_write_tokens=7813,
128
+ input_includes_cache=True,
129
+ provider_details={"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7813}})),
121
130
  "openai-gpt-reads": ({"prompt_tokens": 7822, "completion_tokens": 2, "total_tokens": 7824,
122
131
  "prompt_tokens_details": {"audio_tokens": 0, "cached_tokens": 7680}},
123
132
  Usage(input_tokens=7822, output_tokens=2, total_tokens=7824, cache_read_tokens=7680,
@@ -138,3 +147,46 @@ RESPONSES = {
138
147
  @pytest.mark.parametrize("response, expected", RESPONSES.values(), ids=RESPONSES.keys())
139
148
  def test_a_model_responses_usage_reads_with_input_counting_the_cache(response, expected):
140
149
  assert Usage.from_model_response(response) == expected
150
+
151
+
152
+ def test_an_older_agents_split_in_provider_details_is_read_into_its_writes_by_time():
153
+ usage = Usage.from_dict({"input_tokens": 9, "output_tokens": 5, "cache_write_tokens": 50, "provider_details": {
154
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 30},
155
+ "cache_write_tokens_details": {"ttl_12h_tokens": 20, "ttl_bad_tokens": 4, "ttl_30m_tokens": "x"}}})
156
+
157
+ assert usage.cache_write_ttl_tokens == {"1h": 30, "12h": 20}
158
+ assert Usage.from_dict(usage.to_dict()) == usage
159
+
160
+
161
+ def test_writes_by_time_name_each_time_one_way_and_an_explicit_count_wins_over_the_split():
162
+ usage = Usage(cache_write_ttl_tokens={"60m": 5, "1h": 2, "90s": 1, "24h": 3},
163
+ provider_details={"cache_creation": {"ephemeral_1h_input_tokens": 99}})
164
+
165
+ assert usage.cache_write_ttl_tokens == {"1h": 7, "90s": 1, "1d": 3}
166
+ assert (ttl_label(5400), ttl_label(43200), ttl_seconds("12h"), ttl_seconds("0m"), ttl_seconds("1w")) == (
167
+ "90m", "12h", 43200, None, None)
168
+
169
+
170
+ @pytest.mark.parametrize("ttl", [{"1w": 5}, {"soon": 5}, {"1h": -1}, {"1h": True}, {"1h": 2.5}, ["1h"]],
171
+ ids=["unit", "no-time", "negative", "bool", "float", "not-a-mapping"])
172
+ def test_writes_by_time_that_name_no_time_or_hold_no_count_are_refused(ttl):
173
+ with pytest.raises((ValueError, TypeError)):
174
+ Usage.from_dict({"cache_write_ttl_tokens": ttl})
175
+
176
+
177
+ def test_a_turn_without_writes_by_time_takes_its_rows_and_a_models_row_sums_its_calls():
178
+ rows = (ModelUsage(model="a", cache_write_tokens=5, cache_write_ttl_tokens={"1h": 5}),
179
+ ModelUsage(model="b", cache_write_tokens=2, cache_write_ttl_tokens={"5m": 2}))
180
+ calls = [Usage(cache_write_ttl_tokens={"1h": 3}), Usage(cache_write_ttl_tokens={"1h": 2, "5m": 1}), Usage()]
181
+
182
+ assert Usage(models=rows).cache_write_ttl_tokens == {"1h": 5, "5m": 2}
183
+ assert Usage(models=(rows[0], ModelUsage(model="c", cache_write_tokens=1))).cache_write_ttl_tokens is None
184
+ assert ModelUsage.of("a", calls).cache_write_ttl_tokens == {"1h": 5, "5m": 1}
185
+
186
+
187
+ def test_writes_by_time_as_stored_are_read_by_seconds_leaving_out_what_cant_be_read():
188
+ stored = {"1h": 5, "60m": 2, "soon": 3, "2h": -1, "5m": True, "12h": 4}
189
+
190
+ assert ttl_counts_in_seconds(stored) == {3600: 7, 43200: 4}
191
+ assert ttl_counts_in_seconds(["1h"]) == {} == ttl_counts_in_seconds(None)
192
+ assert ttl_sum([{3600: 1}, None, {3600: 2, 300: 1}]) == {3600: 3, 300: 1} and ttl_sum([None]) is None