agentenv-framework-protocol 0.1.622__tar.gz → 0.1.623__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 (260) hide show
  1. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/PKG-INFO +22 -4
  2. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/README.md +21 -3
  3. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/pyproject.toml +1 -1
  4. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/__init__.py +4 -0
  5. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +36 -6
  6. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/extensions.py +29 -3
  7. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/framework.py +35 -3
  8. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_atif_media.py +28 -16
  9. agentenv_framework_protocol-0.1.623/tests/test_a2a_atif_prescribe.py +103 -0
  10. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_atif_scrubbing.py +8 -16
  11. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_atif_serving.py +35 -17
  12. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_atif_turns.py +14 -13
  13. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/.gitignore +0 -0
  14. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/LICENSE +0 -0
  15. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/NOTICE +0 -0
  16. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/THIRD_PARTY_NOTICES.md +0 -0
  17. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/__init__.py +0 -0
  18. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/advanced_agent.py +0 -0
  19. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/basic_agent.py +0 -0
  20. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/custom_extensions_agent.py +0 -0
  21. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/multimodal_agent.py +0 -0
  22. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/reference_model.py +0 -0
  23. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/streaming_agent.py +0 -0
  24. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/.gitignore +0 -0
  25. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/Dockerfile +0 -0
  26. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/Dockerfile.dockerignore +0 -0
  27. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/README.md +0 -0
  28. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/data/seed.json +0 -0
  29. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/env.toml +0 -0
  30. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/site.py +0 -0
  31. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/index.html +0 -0
  32. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/package-lock.json +0 -0
  33. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/package.json +0 -0
  34. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/src/main.js +0 -0
  35. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/src/style.css +0 -0
  36. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/examples/website/notes/web/vite.config.js +0 -0
  37. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/__init__.py +0 -0
  38. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_atif_copy.py +0 -0
  39. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_media_spool.py +0 -0
  40. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_secrets.py +0 -0
  41. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_snapshot_state.py +0 -0
  42. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  43. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/_turn_index.py +0 -0
  44. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/clock.py +0 -0
  45. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/control_token.py +0 -0
  46. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  47. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
  48. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  49. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  50. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  51. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
  52. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/agent_env_environment.py +0 -0
  53. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/PROFILE.md +0 -0
  54. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/__init__.py +0 -0
  55. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/__main__.py +0 -0
  56. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/_image_size.py +0 -0
  57. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/adapter.py +0 -0
  58. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/builder.py +0 -0
  59. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/coding.json +0 -0
  60. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/coding.stripped.json +0 -0
  61. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/computer_use.json +0 -0
  62. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/late_result.json +0 -0
  63. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/482405b002a62efa8516c36709a7a100637507670576fa73a20ad5420d55c66f.png +0 -0
  64. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/55c64d0fcd6f9d5f7c828093857e3fdfda68478bb4e9bd24d481ef391c7804e8.heic +0 -0
  65. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/67905ad3cc2dd52b1f5f6a6d2814de0396618b29b4238b9af5207aeb69936e6d.mp4 +0 -0
  66. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/69a8aa01fe5537076d023dd5e9cc4275b39fc0434aa6483a9f58b66ef2f3c896.png +0 -0
  67. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/82e60066a2de261b6653bcdda90d1cb9a7af2f474cecd82e8d371e8384d72315.png +0 -0
  68. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/media/845e91831319e89c4d656bdb80c278ac09a7230d61e5dfd2e1b1fbb436ac8917.pdf +0 -0
  69. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/multi_agent.json +0 -0
  70. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/odd_parts.json +0 -0
  71. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/subagent.json +0 -0
  72. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/fixtures/two_turns.json +0 -0
  73. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/kit.py +0 -0
  74. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/LICENSE +0 -0
  75. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/VENDORED.md +0 -0
  76. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/__init__.py +0 -0
  77. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/agent.py +0 -0
  78. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/content.py +0 -0
  79. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/final_metrics.py +0 -0
  80. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/metrics.py +0 -0
  81. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/observation.py +0 -0
  82. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/observation_result.py +0 -0
  83. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/step.py +0 -0
  84. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/subagent_trajectory_ref.py +0 -0
  85. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/tool_call.py +0 -0
  86. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/models/trajectory.py +0 -0
  87. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/profile.py +0 -0
  88. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/reader.py +0 -0
  89. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/runner.py +0 -0
  90. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/served.py +0 -0
  91. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/atif/validator.py +0 -0
  92. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/client.py +0 -0
  93. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/__init__.py +0 -0
  94. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_declare.py +0 -0
  95. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_desktop.py +0 -0
  96. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_job.py +0 -0
  97. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_linux.py +0 -0
  98. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_load.py +0 -0
  99. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_macos.py +0 -0
  100. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_reaping.py +0 -0
  101. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  102. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  103. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_windows.py +0 -0
  104. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  105. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/_x11.py +0 -0
  106. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/annotate.py +0 -0
  107. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/app.py +0 -0
  108. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/app_data.py +0 -0
  109. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  110. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/apps.py +0 -0
  111. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/card.py +0 -0
  112. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/checks.py +0 -0
  113. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/clock.py +0 -0
  114. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  115. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  116. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  117. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  118. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  119. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  120. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  121. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  122. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  123. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  124. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/dataplane.py +0 -0
  125. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/driver.py +0 -0
  126. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/errors.py +0 -0
  127. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/extensions.py +0 -0
  128. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/frames.py +0 -0
  129. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/keys.py +0 -0
  130. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/launch.py +0 -0
  131. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/manifest.py +0 -0
  132. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/operations.py +0 -0
  133. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/platform.py +0 -0
  134. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/prefix.py +0 -0
  135. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/queue.py +0 -0
  136. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/recording.py +0 -0
  137. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/results.py +0 -0
  138. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  139. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/runtime.py +0 -0
  140. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/seed.py +0 -0
  141. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/serve.py +0 -0
  142. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/serve_app.py +0 -0
  143. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/served.py +0 -0
  144. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/session.py +0 -0
  145. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/settings.py +0 -0
  146. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/skill.py +0 -0
  147. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/spaces.py +0 -0
  148. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/svc.py +0 -0
  149. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/computer/tools.py +0 -0
  150. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/errors.py +0 -0
  151. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/manifest.py +0 -0
  152. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/passthrough.py +0 -0
  153. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/preflight.py +0 -0
  154. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/tool_access.py +0 -0
  155. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/tool_client.py +0 -0
  156. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/tool_context.py +0 -0
  157. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/transfers.py +0 -0
  158. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/types.py +0 -0
  159. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/__init__.py +0 -0
  160. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/clock.py +0 -0
  161. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/conformance.py +0 -0
  162. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/environment.py +0 -0
  163. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/errors.py +0 -0
  164. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/forwarding.py +0 -0
  165. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/readiness.py +0 -0
  166. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/routes.py +0 -0
  167. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website/session.py +0 -0
  168. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  169. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/cdp.py +0 -0
  170. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/contexts.py +0 -0
  171. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/control.py +0 -0
  172. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/data.py +0 -0
  173. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/devtools.py +0 -0
  174. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/environment.py +0 -0
  175. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/log.py +0 -0
  176. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/network.py +0 -0
  177. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/recording.py +0 -0
  178. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/scope.py +0 -0
  179. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  180. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/src/agentenv_protocol/website_browser/stream.py +0 -0
  181. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/atif_cases.py +0 -0
  182. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/computer_fake.py +0 -0
  183. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/conftest.py +0 -0
  184. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/probe_fake.py +0 -0
  185. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_agent.py +0 -0
  186. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_agent_clock.py +0 -0
  187. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_agent_examples.py +0 -0
  188. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_cdp_config.py +0 -0
  189. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_object_transfers.py +0 -0
  190. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_peer_agents.py +0 -0
  191. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_proxy.py +0 -0
  192. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_staging.py +0 -0
  193. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_a2a_trajectory_log.py +0 -0
  194. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_agent_env_environment.py +0 -0
  195. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_builder.py +0 -0
  196. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_fixtures.py +0 -0
  197. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_kit.py +0 -0
  198. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_profile.py +0 -0
  199. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_reader.py +0 -0
  200. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_validator.py +0 -0
  201. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_atif_vendored.py +0 -0
  202. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_cdp.py +0 -0
  203. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_contexts.py +0 -0
  204. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_data.py +0 -0
  205. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_log.py +0 -0
  206. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_network.py +0 -0
  207. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_recording.py +0 -0
  208. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_browser_state.py +0 -0
  209. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_client.py +0 -0
  210. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_app_data.py +0 -0
  211. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_app_server.py +0 -0
  212. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_clock.py +0 -0
  213. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_conformance.py +0 -0
  214. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_conformance_attempts.py +0 -0
  215. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_conformance_checks.py +0 -0
  216. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_conformance_page.py +0 -0
  217. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_conformance_recording.py +0 -0
  218. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_dataplane.py +0 -0
  219. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_declare.py +0 -0
  220. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_driver.py +0 -0
  221. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_driver_keys.py +0 -0
  222. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_extensions.py +0 -0
  223. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_frames.py +0 -0
  224. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_macos.py +0 -0
  225. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_page.py +0 -0
  226. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_queue.py +0 -0
  227. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_recording.py +0 -0
  228. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_recording_annotate.py +0 -0
  229. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_seed.py +0 -0
  230. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_serve.py +0 -0
  231. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_served.py +0 -0
  232. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_session_windows.py +0 -0
  233. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_spaces.py +0 -0
  234. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_svc_forward.py +0 -0
  235. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_tool_prefix.py +0 -0
  236. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_computer_windows_driver.py +0 -0
  237. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_control_token.py +0 -0
  238. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_data_objects.py +0 -0
  239. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_devtools_pipe.py +0 -0
  240. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_errors.py +0 -0
  241. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_extension_methods.py +0 -0
  242. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_intake.py +0 -0
  243. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_manifest.py +0 -0
  244. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_preflight.py +0 -0
  245. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_access.py +0 -0
  246. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_annotations.py +0 -0
  247. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_client.py +0 -0
  248. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_context.py +0 -0
  249. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_context_fastmcp.py +0 -0
  250. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_tool_context_injection.py +0 -0
  251. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_usage.py +0 -0
  252. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_api.py +0 -0
  253. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_browser.py +0 -0
  254. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_conformance.py +0 -0
  255. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_environment.py +0 -0
  256. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_forwarding.py +0 -0
  257. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_live.py +0 -0
  258. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_mcp.py +0 -0
  259. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/tests/test_website_notes_example.py +0 -0
  260. {agentenv_framework_protocol-0.1.622 → agentenv_framework_protocol-0.1.623}/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.622
3
+ Version: 0.1.623
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
@@ -1694,9 +1694,27 @@ responses, the format it serves.
1694
1694
  enable(TRAJECTORY_V1, live=True, native="my-cli-events/1", atif=MyCliAtif)
1695
1695
  ```
1696
1696
 
1697
- The card then lists `atif/1` in `formats` too; `default` stays `native`. The
1698
- SDK keeps one ATIF document per A2A context, run through one adapter instance,
1699
- and feeds it every event the agent appends, as it appends it. A native
1697
+ The card then lists `atif/1` in `formats` too; `default` stays `native`.
1698
+
1699
+ The agent builds `atif/1` only when prescribed: a run that reads its copies
1700
+ says so first with the trajectory extension's `prescribe`
1701
+ (`POST /ext/trajectory/prescribe`, `{formats: ["atif/1"]}`, each a format the
1702
+ card offers; it answers every format the agent now builds, native first).
1703
+
1704
+ - A prescription holds for each A2A context started after it. A context keeps the
1705
+ formats it started with, so no copy misses its first turns, and a later call
1706
+ sets them for the contexts after it.
1707
+ - It's one setting for the whole agent. An agent that serves several runs builds,
1708
+ for each new context, what the last call prescribed, whichever run made it.
1709
+ - With no call the agent builds native only: no ATIF document, no media spool,
1710
+ and no turn count of its own. A snapshot restored into it still records the
1711
+ count the snapshot carries, so a context prescribed `atif/1` later numbers its
1712
+ turns on from there.
1713
+ - An `atif/1` read of a context that wasn't prescribed it is refused with `409
1714
+ format_not_prescribed`. A read that names no format always gets native.
1715
+
1716
+ For a context prescribed `atif/1`, the SDK keeps one ATIF document, run through
1717
+ one adapter instance, and feeds it every event the agent appends, as it appends it. A native
1700
1718
  trajectory returned at task end runs through the adapter then. The agent's own
1701
1719
  code feeds the adapter's aux files, records that aren't in the native log such
1702
1720
  as a hook's notes, with `request.trajectory.aux(name, record)`, where they
@@ -1623,9 +1623,27 @@ responses, the format it serves.
1623
1623
  enable(TRAJECTORY_V1, live=True, native="my-cli-events/1", atif=MyCliAtif)
1624
1624
  ```
1625
1625
 
1626
- The card then lists `atif/1` in `formats` too; `default` stays `native`. The
1627
- SDK keeps one ATIF document per A2A context, run through one adapter instance,
1628
- and feeds it every event the agent appends, as it appends it. A native
1626
+ The card then lists `atif/1` in `formats` too; `default` stays `native`.
1627
+
1628
+ The agent builds `atif/1` only when prescribed: a run that reads its copies
1629
+ says so first with the trajectory extension's `prescribe`
1630
+ (`POST /ext/trajectory/prescribe`, `{formats: ["atif/1"]}`, each a format the
1631
+ card offers; it answers every format the agent now builds, native first).
1632
+
1633
+ - A prescription holds for each A2A context started after it. A context keeps the
1634
+ formats it started with, so no copy misses its first turns, and a later call
1635
+ sets them for the contexts after it.
1636
+ - It's one setting for the whole agent. An agent that serves several runs builds,
1637
+ for each new context, what the last call prescribed, whichever run made it.
1638
+ - With no call the agent builds native only: no ATIF document, no media spool,
1639
+ and no turn count of its own. A snapshot restored into it still records the
1640
+ count the snapshot carries, so a context prescribed `atif/1` later numbers its
1641
+ turns on from there.
1642
+ - An `atif/1` read of a context that wasn't prescribed it is refused with `409
1643
+ format_not_prescribed`. A read that names no format always gets native.
1644
+
1645
+ For a context prescribed `atif/1`, the SDK keeps one ATIF document, run through
1646
+ one adapter instance, and feeds it every event the agent appends, as it appends it. A native
1629
1647
  trajectory returned at task end runs through the adapter then. The agent's own
1630
1648
  code feeds the adapter's aux files, records that aren't in the native log such
1631
1649
  as a hook's notes, with `request.trajectory.aux(name, record)`, where they
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentenv-framework-protocol"
3
- version = "0.1.622"
3
+ version = "0.1.623"
4
4
  description = "Open data-plane protocol and server SDK for agent environments."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -79,6 +79,8 @@ from .extensions import (
79
79
  TrajectoryEventsResponse,
80
80
  TrajectoryMediaRequest,
81
81
  TrajectoryMediaResponse,
82
+ TrajectoryPrescribeRequest,
83
+ TrajectoryPrescribeResponse,
82
84
  TrajectoryObjectsResponse,
83
85
  AtifEventsResponse,
84
86
  AtifObjectsResponse,
@@ -260,6 +262,8 @@ __all__ = [
260
262
  "TrajectoryLog",
261
263
  "TrajectoryMediaRequest",
262
264
  "TrajectoryMediaResponse",
265
+ "TrajectoryPrescribeRequest",
266
+ "TrajectoryPrescribeResponse",
263
267
  "TrajectoryObjectsResponse",
264
268
  "TrajectoryState",
265
269
  "TrajectoryUploadedObjects",
@@ -6,8 +6,9 @@ import json
6
6
  import logging
7
7
  from collections import OrderedDict
8
8
  from dataclasses import dataclass
9
- from typing import Any, Callable, Sequence
9
+ from typing import Any, Callable, Iterable, Sequence
10
10
 
11
+ from ..atif import FORMAT as ATIF_FORMAT
11
12
  from ..atif import Adapter
12
13
  from ._atif_copy import AtifCopy, AtifPage, TurnStart
13
14
  from ._media_spool import MediaSpool
@@ -21,6 +22,15 @@ MAX_CACHED_CONTEXTS = 1_024
21
22
  MAX_TRAJECTORY_READ_BYTES = 4 * 1024 * 1024
22
23
 
23
24
 
25
+ class NotPrescribed(LookupError):
26
+ """A read of a format the conversation it names was not prescribed when it started."""
27
+
28
+ def __init__(self, context_id: str, format: str) -> None:
29
+ super().__init__(f"context {context_id!r} was not prescribed {format}, so it has no {format} copy")
30
+ self.context_id = context_id
31
+ self.format = format
32
+
33
+
24
34
  @dataclass(slots=True)
25
35
  class _TaskRecord:
26
36
  context_id: str
@@ -104,6 +114,16 @@ class TaskTrajectories:
104
114
  self._tasks: dict[str, _TaskRecord] = {}
105
115
  self._contexts: OrderedDict[str, list[str]] = OrderedDict()
106
116
  self._copies: dict[str, AtifCopy] = {}
117
+ #: The formats beside native a conversation started from now on is built in: none until prescribed.
118
+ self._prescribed: frozenset[str] = frozenset()
119
+ #: Each started conversation's formats beside native, fixed as its first task starts.
120
+ self._built: dict[str, frozenset[str]] = {}
121
+
122
+ def prescribe(self, formats: Iterable[str]) -> frozenset[str]:
123
+ """Build ``formats`` beside native for each conversation started from now on; one already started keeps the
124
+ formats it started with, so no copy misses its first turns."""
125
+ self._prescribed = frozenset(formats) - {self._native}
126
+ return self._prescribed
107
127
 
108
128
  def register(self, task_id: str, context_id: str) -> TrajectoryLog:
109
129
  """The task's log, created ``pending`` the first time the task is seen."""
@@ -132,7 +152,8 @@ class TaskTrajectories:
132
152
  started = sum(1 for other in order if self._tasks[other].started)
133
153
  order.insert(started, task_id)
134
154
  record.started = True
135
- if self._atif is not None and turn is not None:
155
+ built = self._built.setdefault(record.context_id, self._prescribed)
156
+ if self._atif is not None and turn is not None and ATIF_FORMAT in built:
136
157
  copy = self._copies.get(record.context_id)
137
158
  if copy is None:
138
159
  copy = self._copies[record.context_id] = AtifCopy(
@@ -153,6 +174,7 @@ class TaskTrajectories:
153
174
  new document, since the conversation is the snapshot's now; an agent that serves atif/1 only."""
154
175
  self._turns.set(context_id, turns)
155
176
  self._copies.pop(context_id, None)
177
+ self._built.pop(context_id, None)
156
178
  self.media.drop(context_id)
157
179
 
158
180
  def request_cancel(self, task_id: str) -> None:
@@ -281,7 +303,7 @@ class TaskTrajectories:
281
303
  """The ended task's atif/1 document as it stood when it ended, with its aux log and served
282
304
  turn context, or None when there is none."""
283
305
  record = self._tasks.get(task_id)
284
- copy = self._copies.get(record.context_id) if record is not None else None
306
+ copy = self._copy(record.context_id) if record is not None else None
285
307
  if copy is None:
286
308
  return None
287
309
  self._touch(record.context_id)
@@ -290,7 +312,7 @@ class TaskTrajectories:
290
312
 
291
313
  def atif_context(self, context_id: str) -> dict[str, Any] | None:
292
314
  """The context's atif/1 live page, or None when it has no closed step yet."""
293
- copy = self._copies.get(context_id)
315
+ copy = self._copy(context_id)
294
316
  if copy is None:
295
317
  return None
296
318
  self._touch(context_id)
@@ -301,7 +323,7 @@ class TaskTrajectories:
301
323
  ) -> AtifCursor | None:
302
324
  """A cursor page of the task's closed atif/1 steps, in the task's state."""
303
325
  record = self._tasks.get(task_id)
304
- copy = self._copies.get(record.context_id) if record is not None else None
326
+ copy = self._copy(record.context_id) if record is not None else None
305
327
  if copy is None:
306
328
  return None
307
329
  self._touch(record.context_id)
@@ -314,7 +336,7 @@ class TaskTrajectories:
314
336
  ) -> AtifCursor | None:
315
337
  """A cursor page of the context's closed atif/1 steps, on the task the context is on and in
316
338
  the context's state."""
317
- copy = self._copies.get(context_id)
339
+ copy = self._copy(context_id)
318
340
  records = self._context_records(context_id) if copy is not None else None
319
341
  if copy is None or records is None:
320
342
  return None
@@ -322,6 +344,13 @@ class TaskTrajectories:
322
344
  page = copy.page(after, max_steps, max_bytes)
323
345
  return AtifCursor(page=page, context_id=context_id, task_id=task_id, state=state)
324
346
 
347
+ def _copy(self, context_id: str) -> AtifCopy | None:
348
+ """The context's atif/1 copy, None before it has one; NotPrescribed when it started without atif/1."""
349
+ built = self._built.get(context_id)
350
+ if built is not None and ATIF_FORMAT not in built:
351
+ raise NotPrescribed(context_id, ATIF_FORMAT)
352
+ return self._copies.get(context_id)
353
+
325
354
  def _context_progress(
326
355
  self, context_id: str, records: list[_TaskRecord]
327
356
  ) -> tuple[str, TrajectoryState]:
@@ -362,6 +391,7 @@ class TaskTrajectories:
362
391
  continue
363
392
  del self._contexts[context_id]
364
393
  self._copies.pop(context_id, None)
394
+ self._built.pop(context_id, None)
365
395
  self.media.drop(context_id)
366
396
  for task_id in task_ids:
367
397
  del self._tasks[task_id]
@@ -233,6 +233,19 @@ class TrajectoryMediaResponse(ExtensionResponse):
233
233
  failed: dict[str, str] = Field(default_factory=dict)
234
234
 
235
235
 
236
+ class TrajectoryPrescribeRequest(ExtensionRequest):
237
+ """The trajectory formats beside native the agent builds for each conversation it starts from now on, each one
238
+ its card's ``formats`` lists; none for native only, which it always builds."""
239
+
240
+ formats: list[str] = Field(default_factory=list)
241
+
242
+
243
+ class TrajectoryPrescribeResponse(ExtensionResponse):
244
+ """Every format the agent builds for a conversation it starts from now on: native first."""
245
+
246
+ formats: list[str]
247
+
248
+
236
249
  class AtifUploadedObjects(ExtensionResponse):
237
250
  trajectory: Uploaded
238
251
  aux: Uploaded | None = None
@@ -1227,8 +1240,8 @@ def _configure_trajectory(
1227
1240
  return ExtensionConfiguration(
1228
1241
  wire_params={"formats": formats, "native": native, "default": native} if native else {},
1229
1242
  options={"native": native, **({"atif": atif} if atif is not None else {})} if native else {},
1230
- # An agent that serves atif/1 hands over its copies' media files, which the worker pulls at each turn's end.
1231
- features={"media"} if atif is not None else frozenset(),
1243
+ # An agent that can build atif/1 builds it only when prescribed, and hands over its copies' media files.
1244
+ features={"media", "prescribe"} if atif is not None else frozenset(),
1232
1245
  variants=(
1233
1246
  {"get": {"task_events", "context_events", "context", "context_objects"}} if live else {}
1234
1247
  ),
@@ -1389,7 +1402,20 @@ TRAJECTORY_V1 = ExtensionDefinition(
1389
1402
  sdk_only=True,
1390
1403
  ),
1391
1404
  }
1392
- )
1405
+ ),
1406
+ "prescribe": OperationGroup(
1407
+ operations={
1408
+ "prescribe": _op(
1409
+ "prescribe",
1410
+ "POST",
1411
+ "/ext/trajectory/prescribe",
1412
+ SDK,
1413
+ request_model=TrajectoryPrescribeRequest,
1414
+ response_model=TrajectoryPrescribeResponse,
1415
+ sdk_only=True,
1416
+ ),
1417
+ }
1418
+ ),
1393
1419
  },
1394
1420
  configuration_validator=_configure_trajectory,
1395
1421
  )
@@ -36,7 +36,7 @@ from ..atif import SCHEMA_VERSION as ATIF_SCHEMA_VERSION
36
36
  from ._atif_copy import TurnStart
37
37
  from ._secrets import Secrets
38
38
  from ._snapshot_state import SnapshotStates
39
- from ._trajectory_log import MAX_TRAJECTORY_READ_BYTES, TaskTrajectories
39
+ from ._trajectory_log import MAX_TRAJECTORY_READ_BYTES, NotPrescribed, TaskTrajectories
40
40
  from ._triggers import TriggerEngine, TriggerError
41
41
  from .extensions import (
42
42
  AGENT_CONFIG_V1,
@@ -69,6 +69,8 @@ from .extensions import (
69
69
  AtifUploadedObjects,
70
70
  TrajectoryEventsResponse,
71
71
  TrajectoryMediaRequest,
72
+ TrajectoryPrescribeRequest,
73
+ TrajectoryPrescribeResponse,
72
74
  TrajectoryObjectsResponse,
73
75
  TrajectoryState,
74
76
  TrajectoryUploadedObjects,
@@ -147,6 +149,16 @@ def _config_wire_names(config: type[AgentConfig]) -> dict[str, str]:
147
149
  return result
148
150
 
149
151
 
152
+
153
+ def _not_prescribed(exc: NotPrescribed) -> AgentEnvError:
154
+ return AgentEnvError(
155
+ "format_not_prescribed",
156
+ f"{exc.format} was not prescribed for context {exc.context_id!r} when it started, so the agent built none; "
157
+ "prescribe it before a conversation's first message (the trajectory extension's prescribe)",
158
+ status=409,
159
+ )
160
+
161
+
150
162
  def _config_write_only_wire_names(config: type[AgentConfig]) -> set[str]:
151
163
  """Return wire names explicitly marked as write-only in the config schema."""
152
164
  wire_names = _config_wire_names(config)
@@ -684,6 +696,7 @@ class _SdkServices:
684
696
  (SKILL_CONFIG_V1.uri, "list"): self.skill_list,
685
697
  (TRAJECTORY_V1.uri, "get"): self.trajectory_get,
686
698
  (TRAJECTORY_V1.uri, "media"): self.trajectory_media,
699
+ (TRAJECTORY_V1.uri, "prescribe"): self.trajectory_prescribe,
687
700
  (TRIGGERS_V1.uri, "register"): self.triggers_register,
688
701
  (TRIGGERS_V1.uri, "decide"): self.triggers_decide,
689
702
  (TRIGGERS_V1.uri, "state"): self.triggers_state,
@@ -905,6 +918,8 @@ class _SdkServices:
905
918
  request.context_id, request.after, max_steps, MAX_TRAJECTORY_READ_BYTES
906
919
  )
907
920
  unknown = f"Unknown context '{request.context_id}'"
921
+ except NotPrescribed as exc:
922
+ raise _not_prescribed(exc) from exc
908
923
  except ValueError as exc:
909
924
  raise HTTPException(status_code=400, detail=str(exc)) from exc
910
925
  if cursor is None:
@@ -934,7 +949,10 @@ class _SdkServices:
934
949
  through the request's grants, as the copy serves it, its secrets scrubbed."""
935
950
  served: dict[str, Any] = {}
936
951
  if isinstance(request, (TaskTrajectoryRequest, TaskObjectTrajectoryRequest)):
937
- read = self.task_trajectories.atif_task(request.task_id)
952
+ try:
953
+ read = self.task_trajectories.atif_task(request.task_id)
954
+ except NotPrescribed as exc:
955
+ raise _not_prescribed(exc) from exc
938
956
  if read is None:
939
957
  raise HTTPException(
940
958
  status_code=404,
@@ -945,7 +963,10 @@ class _SdkServices:
945
963
  else:
946
964
  if isinstance(request, ContextObjectTrajectoryRequest):
947
965
  _refuse_turn_objects(request)
948
- document = self.task_trajectories.atif_context(request.context_id)
966
+ try:
967
+ document = self.task_trajectories.atif_context(request.context_id)
968
+ except NotPrescribed as exc:
969
+ raise _not_prescribed(exc) from exc
949
970
  if document is None:
950
971
  raise HTTPException(
951
972
  status_code=404,
@@ -966,6 +987,17 @@ class _SdkServices:
966
987
  )
967
988
  return AtifObjectsResponse(objects=uploaded, **versions).model_dump(mode="json", exclude_none=True)
968
989
 
990
+ async def trajectory_prescribe(self, request: TrajectoryPrescribeRequest) -> dict[str, Any]:
991
+ """Build ``request.formats`` beside native for each conversation the agent starts from now on; each must be
992
+ one the card offers."""
993
+ for format in request.formats:
994
+ self.check_trajectory_format(format)
995
+ built = self.task_trajectories.prescribe(request.formats)
996
+ native = self.trajectory_formats[0]
997
+ return TrajectoryPrescribeResponse(
998
+ formats=[native, *(format for format in self.trajectory_formats if format in built)]
999
+ ).model_dump(mode="json")
1000
+
969
1001
  async def trajectory_media(self, request: TrajectoryMediaRequest) -> dict[str, Any]:
970
1002
  """Upload the media files of a context's atif/1 copy the worker asks for, from the spool (``MediaSpool.push``)."""
971
1003
  pushed = await self.task_trajectories.media.push(request.context_id, request.objects)
@@ -15,7 +15,7 @@ from typing import Any
15
15
 
16
16
  import pytest
17
17
  from starlette.testclient import TestClient
18
- from test_a2a_atif_serving import _atif, _ended, _send
18
+ from test_a2a_atif_serving import _atif, _ended, _send, _serving
19
19
 
20
20
  from agentenv_protocol.a2a_agent import (
21
21
  TRAJECTORY_V1,
@@ -36,7 +36,17 @@ from agentenv_protocol.a2a_agent import _media_spool
36
36
  from agentenv_protocol.a2a_agent._media_spool import MediaSpool
37
37
  from agentenv_protocol.a2a_agent._atif_copy import TurnStart
38
38
  from agentenv_protocol.a2a_agent._trajectory_log import TaskTrajectories
39
- from agentenv_protocol.atif import Adapter, AtifError, atif_adapter, check_media, errors_in, media_file, native, validate
39
+ from agentenv_protocol.atif import (
40
+ FORMAT,
41
+ Adapter,
42
+ AtifError,
43
+ atif_adapter,
44
+ check_media,
45
+ errors_in,
46
+ media_file,
47
+ native,
48
+ validate,
49
+ )
40
50
  from agentenv_protocol.atif._image_size import image_size
41
51
  from agentenv_protocol.transfers import TransferError, WriteObject
42
52
 
@@ -119,7 +129,7 @@ def _media(client: TestClient, paths: dict[str, str], context_id: str = "ctx-1")
119
129
 
120
130
 
121
131
  def test_a_copys_images_are_spooled_by_sha256_with_their_size_and_pushed_once_asked(store: dict[str, bytes]) -> None:
122
- with TestClient(_shooting().create_app()) as client:
132
+ with _serving(_shooting()) as client:
123
133
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png", "inbound.png")])
124
134
  _ended(client, task_id)
125
135
  document = _atif(client, task_id=task_id)["trajectory"]
@@ -144,7 +154,7 @@ def test_a_copys_images_are_spooled_by_sha256_with_their_size_and_pushed_once_as
144
154
  def test_a_media_calls_grants_leave_the_copys_media_paths_as_they_are(store: dict[str, bytes]) -> None:
145
155
  """A grant's URL may name the file it writes, ``media/<sha256>.<ext>``: the scrub takes a URL's credential from it,
146
156
  never the file's name, which every read of the copy keeps."""
147
- with TestClient(_shooting().create_app()) as client:
157
+ with _serving(_shooting()) as client:
148
158
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")])
149
159
  _ended(client, task_id)
150
160
  assert _media(client, {_path(SHOT, ".png"): "image/png"}).status_code == 200
@@ -155,7 +165,7 @@ def test_a_media_calls_grants_leave_the_copys_media_paths_as_they_are(store: dic
155
165
 
156
166
 
157
167
  def test_the_same_bytes_added_twice_are_spooled_and_pushed_once(store: dict[str, bytes]) -> None:
158
- with TestClient(_shooting().create_app()) as client:
168
+ with _serving(_shooting()) as client:
159
169
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png"), _file(SHOT, "image/png")])
160
170
  _ended(client, task_id)
161
171
  document = _atif(client, task_id=task_id)["trajectory"]
@@ -177,7 +187,7 @@ def test_a_path_the_context_doesnt_hold_and_a_failed_upload_dont_stop_the_rest(
177
187
  raise TransferError("grant_expired", "The transfer grant expired.")
178
188
  return await stored(target, source)
179
189
 
180
- with TestClient(_shooting().create_app()) as client:
190
+ with _serving(_shooting()) as client:
181
191
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png"), _file(other, "image/png")])
182
192
  _ended(client, task_id)
183
193
  monkeypatch.setattr(_media_spool, "upload", upload)
@@ -204,7 +214,7 @@ def test_an_agent_that_serves_its_own_trajectory_reads_still_has_the_sdks_media_
204
214
  async def trajectory(self, request: TaskTrajectoryRequest | TaskObjectTrajectoryRequest) -> dict[str, Any]:
205
215
  return {"trajectory": []}
206
216
 
207
- with TestClient(OwnReads().create_app()) as client:
217
+ with _serving(OwnReads()) as client:
208
218
  _ended(client, _send(client, "look", "m-1", extra_parts=[_file(SHOT, "image/png")]))
209
219
  assert list(_media(client, {_path(SHOT, ".png"): "image/png"}).json()["objects"]) == [_path(SHOT, ".png")]
210
220
 
@@ -241,7 +251,7 @@ def test_an_upload_that_outlives_its_copy_releases_only_the_hold_it_began_with(
241
251
 
242
252
 
243
253
  def test_a_spooled_file_that_no_longer_matches_its_name_never_reaches_the_store(store: dict[str, bytes]) -> None:
244
- with TestClient(_shooting().create_app()) as client:
254
+ with _serving(_shooting()) as client:
245
255
  _ended(client, _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")]))
246
256
  _spool(client).held("ctx-1", _path(SHOT, ".png")).write_bytes(b"changed on disk")
247
257
  pushed = _media(client, {_path(SHOT, ".png"): "image/png"}).json()
@@ -253,7 +263,7 @@ def test_an_upload_whose_bytes_changed_in_transit_fails_and_its_file_stays_held(
253
263
  async def upload(target, source) -> Uploaded:
254
264
  return Uploaded(size_bytes=len(SHOT), sha256="0" * 64)
255
265
 
256
- with TestClient(_shooting().create_app()) as client:
266
+ with _serving(_shooting()) as client:
257
267
  _ended(client, _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")]))
258
268
  monkeypatch.setattr(_media_spool, "upload", upload)
259
269
  pushed = _media(client, {_path(SHOT, ".png"): "image/png"}).json()
@@ -264,7 +274,7 @@ def test_an_upload_whose_bytes_changed_in_transit_fails_and_its_file_stays_held(
264
274
  def test_a_file_the_spool_cant_write_is_reported_missing_and_the_copy_goes_on(
265
275
  store: dict[str, bytes], tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
266
276
  other = _png(2, 2)
267
- with TestClient(_shooting().create_app()) as client:
277
+ with _serving(_shooting()) as client:
268
278
  spool = _spool(client)
269
279
  spool._folder = tmp_path / "removed"
270
280
  _ended(client, _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")]))
@@ -283,26 +293,26 @@ def test_a_file_the_spool_cant_write_is_reported_missing_and_the_copy_goes_on(
283
293
 
284
294
 
285
295
  def test_a_media_call_takes_only_media_paths() -> None:
286
- with TestClient(_shooting().create_app()) as client:
296
+ with _serving(_shooting()) as client:
287
297
  for path in ("../../etc/passwd", "media/abc.png", "https://elsewhere.example.test/x.png",
288
298
  f"media/{'a' * 64}/x.png"):
289
299
  refused = _media(client, {path: "image/png"})
290
300
  assert refused.status_code == 400, (path, refused.text)
291
301
 
292
302
 
293
- def test_only_an_agent_that_serves_atif_offers_media() -> None:
303
+ def test_only_an_agent_that_can_build_atif_offers_media_and_prescribe() -> None:
294
304
  def methods(agent: AgentEnvAgent) -> set[str]:
295
305
  card = TestClient(agent.create_app()).get("/.well-known/agent-card.json").json()
296
306
  [trajectory] = [ext for ext in card["capabilities"]["extensions"] if ext["uri"] == TRAJECTORY_V1.uri]
297
307
  return set(trajectory["params"]["methods"])
298
308
 
299
- assert methods(_shooting()) == {"get", "media"}
309
+ assert methods(_shooting()) == {"get", "media", "prescribe"}
300
310
  assert methods(_shooting(atif=False)) == {"get"}
301
311
 
302
312
 
303
313
  def test_a_video_and_a_heic_image_are_spooled_and_pushed_like_any_file(store: dict[str, bytes]) -> None:
304
314
  video, heic = b"\x00\x00\x00\x18ftypmp42" + b"v" * 64, b"\x00\x00\x00\x18ftypheic" + b"h" * 64
305
- with TestClient(_shooting().create_app()) as client:
315
+ with _serving(_shooting()) as client:
306
316
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(video, "video/mp4"), _file(heic, "image/heic")])
307
317
  _ended(client, task_id)
308
318
  document = _atif(client, task_id=task_id)["trajectory"]
@@ -318,6 +328,7 @@ def test_a_video_and_a_heic_image_are_spooled_and_pushed_like_any_file(store: di
318
328
 
319
329
  def test_a_context_evicted_or_restored_over_drops_its_media_but_what_another_holds() -> None:
320
330
  trajectories = TaskTrajectories(max_contexts=1, native=NATIVE, atif=Shots)
331
+ trajectories.prescribe([FORMAT])
321
332
 
322
333
  def play(task_id: str, context_id: str, data: bytes) -> None:
323
334
  log = trajectories.register(task_id, context_id)
@@ -338,7 +349,7 @@ def test_a_context_evicted_or_restored_over_drops_its_media_but_what_another_hol
338
349
 
339
350
 
340
351
  def test_the_spool_goes_with_the_server(store: dict[str, bytes]) -> None:
341
- with TestClient(_shooting().create_app()) as client:
352
+ with _serving(_shooting()) as client:
342
353
  _ended(client, _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")]))
343
354
  folder = _spool(client).folder
344
355
  assert folder.is_dir()
@@ -346,7 +357,7 @@ def test_the_spool_goes_with_the_server(store: dict[str, bytes]) -> None:
346
357
 
347
358
 
348
359
  def test_the_native_trajectory_is_unchanged_by_media(store: dict[str, bytes]) -> None:
349
- with TestClient(_shooting().create_app()) as client:
360
+ with _serving(_shooting()) as client:
350
361
  task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")])
351
362
  _ended(client, task_id)
352
363
  served = client.post("/ext/trajectory", json={"task_id": task_id}).json()["trajectory"]
@@ -386,6 +397,7 @@ def test_an_images_size_is_read_from_its_header(data: bytes, media_type: str, si
386
397
 
387
398
  def test_dimensions_an_adapter_passes_win_over_the_header() -> None:
388
399
  trajectories = TaskTrajectories(native=NATIVE, atif=Shots)
400
+ trajectories.prescribe([FORMAT])
389
401
  log = trajectories.register("t1", "ctx")
390
402
  trajectories.start("t1", TurnStart(message_id=None, parts=(TextPart(text="hi"),), agent_name="toy",
391
403
  agent_version="1", agent_model=None))
@@ -0,0 +1,103 @@
1
+ """An agent builds the trajectory formats beside native that the run prescribes (``TRAJECTORY_V1.prescribe``), and only
2
+ those: with none prescribed it builds no atif/1 copy, spools no media and counts no turns, and its atif/1 reads are
3
+ refused. Each conversation keeps the formats it started with, so no copy misses its first turns."""
4
+ from __future__ import annotations
5
+
6
+ import base64
7
+
8
+ import pytest
9
+ from starlette.testclient import TestClient
10
+ from test_a2a_atif_media import SHOT, Shots, _file, _path, _shooting
11
+ from test_a2a_atif_serving import _ended, _read, _send, prescribe
12
+
13
+ from agentenv_protocol.a2a_agent import TextPart, TrajectoryState
14
+ from agentenv_protocol.a2a_agent import _turn_index
15
+ from agentenv_protocol.a2a_agent._atif_copy import TurnStart
16
+ from agentenv_protocol.a2a_agent._trajectory_log import NotPrescribed, TaskTrajectories
17
+ from agentenv_protocol.atif import FORMAT
18
+
19
+ NATIVE = "shots/1"
20
+
21
+
22
+ def _services(client: TestClient):
23
+ return client.app.state.agentenv_a2a.services
24
+
25
+
26
+ def _atif_reads(client: TestClient, task_id: str, context_id: str) -> list:
27
+ """Every atif/1 read of a task and its context: the task read, the context read and both cursor pages."""
28
+ return [_read(client, format=FORMAT, task_id=task_id), _read(client, format=FORMAT, context_id=context_id),
29
+ _read(client, format=FORMAT, task_id=task_id, after=0), _read(client, format=FORMAT, context_id=context_id,
30
+ after=0)]
31
+
32
+
33
+ def test_an_agent_prescribed_nothing_builds_only_native_and_refuses_atif_reads() -> None:
34
+ with TestClient(_shooting().create_app()) as client:
35
+ task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")])
36
+ _ended(client, task_id)
37
+ reads = _atif_reads(client, task_id, "ctx-1")
38
+ native = _read(client, task_id=task_id).json()
39
+ services = _services(client)
40
+ assert services.task_trajectories._copies == {} and services.task_trajectories.media.folder is None
41
+ assert [read.status_code for read in reads] == [409] * 4
42
+ assert {read.json()["error"]["code"] for read in reads} == {"format_not_prescribed"}
43
+ assert native["format"] == NATIVE and native["trajectory"][0]["type"] == "shot"
44
+ assert not (_turn_index.turns_folder()).exists() or not any(_turn_index.turns_folder().iterdir())
45
+
46
+
47
+ def test_a_conversation_keeps_the_formats_it_started_with_and_a_later_call_sets_the_next_ones() -> None:
48
+ with TestClient(_shooting().create_app()) as client:
49
+ before = _send(client, "shoot", "m-1", context_id="before")
50
+ _ended(client, before)
51
+ assert prescribe(client, FORMAT).json() == {"formats": [NATIVE, FORMAT]}
52
+ again = _send(client, "again", "m-2", context_id="before")
53
+ after = _send(client, "shoot", "m-3", context_id="after", extra_parts=[_file(SHOT, "image/png")])
54
+ _ended(client, again)
55
+ _ended(client, after)
56
+ assert prescribe(client).json() == {"formats": [NATIVE]}
57
+ later = _send(client, "shoot", "m-4", context_id="later")
58
+ _ended(client, later)
59
+ statuses = {name: _read(client, format=FORMAT, task_id=task).status_code
60
+ for name, task in (("before", again), ("after", after), ("later", later))}
61
+ held = _services(client).task_trajectories.media.held("after", _path(SHOT, ".png"))
62
+ assert statuses == {"before": 409, "after": 200, "later": 409}
63
+ assert held is not None
64
+
65
+
66
+ def test_a_prescription_names_only_formats_the_card_offers_and_may_name_native() -> None:
67
+ with TestClient(_shooting().create_app()) as client:
68
+ refused = prescribe(client, "elsewhere/2")
69
+ native_named = prescribe(client, NATIVE, FORMAT).json()
70
+ with TestClient(_shooting(atif=False).create_app()) as client:
71
+ unlisted = prescribe(client, FORMAT)
72
+ assert refused.status_code == 400 and refused.json()["error"]["code"] == "format_not_offered"
73
+ assert native_named == {"formats": [NATIVE, FORMAT]}
74
+ assert unlisted.status_code == 404
75
+
76
+
77
+ def test_a_read_that_names_no_format_gets_native_whatever_is_prescribed() -> None:
78
+ with TestClient(_shooting().create_app()) as client:
79
+ prescribe(client, FORMAT)
80
+ task_id = _send(client, "shoot", "m-1", extra_parts=[_file(SHOT, "image/png")])
81
+ _ended(client, task_id)
82
+ unnamed = _read(client, task_id=task_id).json()
83
+ assert unnamed["format"] == NATIVE
84
+
85
+
86
+ def test_a_conversation_restored_over_takes_the_prescription_in_effect_at_its_next_task() -> None:
87
+ trajectories = TaskTrajectories(native=NATIVE, atif=Shots)
88
+
89
+ def play(task_id: str) -> None:
90
+ log = trajectories.register(task_id, "ctx")
91
+ trajectories.start(task_id, TurnStart(message_id=None, parts=(TextPart(text="hi"),), agent_name="toy",
92
+ agent_version="1", agent_model=None))
93
+ log.append({"type": "shot", "step": "s", "data": base64.b64encode(SHOT).decode(), "media_type": "image/png"})
94
+ trajectories.seal(task_id, TrajectoryState.COMPLETED, final=(TextPart(text="done"),))
95
+
96
+ play("t1")
97
+ with pytest.raises(NotPrescribed):
98
+ trajectories.atif_task("t1")
99
+ trajectories.prescribe([FORMAT])
100
+ trajectories.restored("ctx", 1)
101
+ play("t2")
102
+ assert trajectories.atif_task("t2") is not None
103
+ trajectories.media.close()