agentenv-framework-protocol 0.1.573__tar.gz → 0.1.575__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 (198) hide show
  1. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/.gitignore +2 -0
  2. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/PKG-INFO +1 -1
  3. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/pyproject.toml +1 -1
  4. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/__init__.py +2 -0
  5. agentenv_framework_protocol-0.1.575/src/agentenv_protocol/a2a_agent/clock.py +102 -0
  6. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/extensions.py +32 -0
  7. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/framework.py +23 -0
  8. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/clock.py +38 -13
  9. agentenv_framework_protocol-0.1.575/tests/test_a2a_agent_clock.py +181 -0
  10. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/LICENSE +0 -0
  11. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/NOTICE +0 -0
  12. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/README.md +0 -0
  13. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/THIRD_PARTY_NOTICES.md +0 -0
  14. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/__init__.py +0 -0
  15. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/advanced_agent.py +0 -0
  16. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/basic_agent.py +0 -0
  17. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/custom_extensions_agent.py +0 -0
  18. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/multimodal_agent.py +0 -0
  19. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/reference_model.py +0 -0
  20. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/streaming_agent.py +0 -0
  21. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/.gitignore +0 -0
  22. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/Dockerfile +0 -0
  23. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/Dockerfile.dockerignore +0 -0
  24. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/README.md +0 -0
  25. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/data/seed.json +0 -0
  26. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/env.toml +0 -0
  27. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/site.py +0 -0
  28. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/index.html +0 -0
  29. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/package-lock.json +0 -0
  30. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/package.json +0 -0
  31. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/src/main.js +0 -0
  32. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/src/style.css +0 -0
  33. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/examples/website/notes/web/vite.config.js +0 -0
  34. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/__init__.py +0 -0
  35. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
  36. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  37. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  38. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
  39. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  40. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  41. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  42. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
  43. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/agent_env_environment.py +0 -0
  44. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/client.py +0 -0
  45. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/__init__.py +0 -0
  46. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_declare.py +0 -0
  47. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_desktop.py +0 -0
  48. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_job.py +0 -0
  49. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_linux.py +0 -0
  50. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_load.py +0 -0
  51. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_macos.py +0 -0
  52. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_reaping.py +0 -0
  53. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  54. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  55. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_windows.py +0 -0
  56. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  57. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/_x11.py +0 -0
  58. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/app.py +0 -0
  59. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/app_data.py +0 -0
  60. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  61. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/apps.py +0 -0
  62. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/card.py +0 -0
  63. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/checks.py +0 -0
  64. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  65. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  66. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  67. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  68. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  69. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  70. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  71. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  72. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  73. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  74. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/dataplane.py +0 -0
  75. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/driver.py +0 -0
  76. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/errors.py +0 -0
  77. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/extensions.py +0 -0
  78. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/frames.py +0 -0
  79. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/keys.py +0 -0
  80. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/launch.py +0 -0
  81. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/manifest.py +0 -0
  82. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/operations.py +0 -0
  83. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/platform.py +0 -0
  84. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/prefix.py +0 -0
  85. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/queue.py +0 -0
  86. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/recording.py +0 -0
  87. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/results.py +0 -0
  88. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  89. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/runtime.py +0 -0
  90. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/seed.py +0 -0
  91. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/serve.py +0 -0
  92. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/serve_app.py +0 -0
  93. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/served.py +0 -0
  94. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/session.py +0 -0
  95. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/settings.py +0 -0
  96. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/skill.py +0 -0
  97. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/spaces.py +0 -0
  98. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/svc.py +0 -0
  99. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/computer/tools.py +0 -0
  100. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/errors.py +0 -0
  101. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/manifest.py +0 -0
  102. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/passthrough.py +0 -0
  103. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/preflight.py +0 -0
  104. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/tool_access.py +0 -0
  105. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/tool_client.py +0 -0
  106. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/tool_context.py +0 -0
  107. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/transfers.py +0 -0
  108. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/types.py +0 -0
  109. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/__init__.py +0 -0
  110. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/clock.py +0 -0
  111. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/conformance.py +0 -0
  112. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/environment.py +0 -0
  113. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/errors.py +0 -0
  114. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/forwarding.py +0 -0
  115. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/readiness.py +0 -0
  116. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/routes.py +0 -0
  117. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website/session.py +0 -0
  118. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  119. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/cdp.py +0 -0
  120. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/contexts.py +0 -0
  121. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/control.py +0 -0
  122. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/data.py +0 -0
  123. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/devtools.py +0 -0
  124. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/environment.py +0 -0
  125. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/log.py +0 -0
  126. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/network.py +0 -0
  127. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/recording.py +0 -0
  128. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/scope.py +0 -0
  129. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  130. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/src/agentenv_protocol/website_browser/stream.py +0 -0
  131. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/computer_fake.py +0 -0
  132. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/probe_fake.py +0 -0
  133. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_agent.py +0 -0
  134. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_agent_examples.py +0 -0
  135. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_cdp_config.py +0 -0
  136. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_object_transfers.py +0 -0
  137. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_peer_agents.py +0 -0
  138. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_proxy.py +0 -0
  139. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_staging.py +0 -0
  140. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_a2a_trajectory_log.py +0 -0
  141. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_agent_env_environment.py +0 -0
  142. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_cdp.py +0 -0
  143. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_contexts.py +0 -0
  144. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_data.py +0 -0
  145. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_log.py +0 -0
  146. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_network.py +0 -0
  147. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_recording.py +0 -0
  148. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_browser_state.py +0 -0
  149. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_client.py +0 -0
  150. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_app_data.py +0 -0
  151. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_app_server.py +0 -0
  152. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_clock.py +0 -0
  153. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_conformance.py +0 -0
  154. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_conformance_attempts.py +0 -0
  155. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_conformance_checks.py +0 -0
  156. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_conformance_page.py +0 -0
  157. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_conformance_recording.py +0 -0
  158. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_dataplane.py +0 -0
  159. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_declare.py +0 -0
  160. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_driver.py +0 -0
  161. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_driver_keys.py +0 -0
  162. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_extensions.py +0 -0
  163. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_frames.py +0 -0
  164. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_macos.py +0 -0
  165. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_page.py +0 -0
  166. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_queue.py +0 -0
  167. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_recording.py +0 -0
  168. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_seed.py +0 -0
  169. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_serve.py +0 -0
  170. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_served.py +0 -0
  171. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_session_windows.py +0 -0
  172. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_spaces.py +0 -0
  173. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_svc_forward.py +0 -0
  174. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_tool_prefix.py +0 -0
  175. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_computer_windows_driver.py +0 -0
  176. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_control_token.py +0 -0
  177. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_data_objects.py +0 -0
  178. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_devtools_pipe.py +0 -0
  179. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_errors.py +0 -0
  180. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_extension_methods.py +0 -0
  181. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_intake.py +0 -0
  182. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_manifest.py +0 -0
  183. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_preflight.py +0 -0
  184. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_access.py +0 -0
  185. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_annotations.py +0 -0
  186. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_client.py +0 -0
  187. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_context.py +0 -0
  188. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_context_fastmcp.py +0 -0
  189. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_tool_context_injection.py +0 -0
  190. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_api.py +0 -0
  191. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_browser.py +0 -0
  192. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_conformance.py +0 -0
  193. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_environment.py +0 -0
  194. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_forwarding.py +0 -0
  195. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_live.py +0 -0
  196. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_mcp.py +0 -0
  197. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_notes_example.py +0 -0
  198. {agentenv_framework_protocol-0.1.573 → agentenv_framework_protocol-0.1.575}/tests/test_website_readiness.py +0 -0
@@ -168,6 +168,8 @@ cython_debug/
168
168
 
169
169
  # Generated local-store state (stores default local; see runtime._ensure_agentenv_gitignore)
170
170
  /.agentenv/
171
+ # ...and what the protocol package's tests write when run from its own folder (launches, browser tab events)
172
+ /packages/agentenv-protocol/.agentenv/
171
173
 
172
174
  # Written by the release workflow into the wheels it publishes
173
175
  src/agent_env/env/published_images.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentenv-framework-protocol
3
- Version: 0.1.573
3
+ Version: 0.1.575
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentenv-framework-protocol"
3
- version = "0.1.573"
3
+ version = "0.1.575"
4
4
  description = "Open data-plane protocol and server SDK for agent environments."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -15,6 +15,7 @@ from .extensions import (
15
15
  STANDARD_EXTENSIONS,
16
16
  TRAJECTORY_V1,
17
17
  TRIGGERS_V1,
18
+ CLOCK_V1,
18
19
  AttributionProbeResponse,
19
20
  BundleSkillRequest,
20
21
  CdpAddRequest,
@@ -152,6 +153,7 @@ __all__ = [
152
153
  "STANDARD_EXTENSIONS",
153
154
  "TRAJECTORY_V1",
154
155
  "TRIGGERS_V1",
156
+ "CLOCK_V1",
155
157
  "A2AAgentApplication",
156
158
  "AgentCapabilities",
157
159
  "AgentConfig",
@@ -0,0 +1,102 @@
1
+ """An agent's side of clock/v1. An agent image that follows the env's clock runs the computer base's follower, and
2
+ agent-env's libfaketime is preloaded for the agent's user, so every program the A2A server starts reads universe time
3
+ from the follower's page; the server itself starts with the real-time marker and stays on real time.
4
+
5
+ The framework serves clock/v1's ``sync_time``, the method every server and computer that follows the clock serves, on
6
+ the card of an agent in such an image (``follows``), so the card is what tells core the agent follows. Unlike a
7
+ computer's, whose config core writes through the sandbox's root channel, an agent's request carries the follower's
8
+ config itself (``watch_url``, ``name``, ``read_token``), and this server, running as the agent's user, writes it: the
9
+ model's own commands could rewrite it and fool their own view of the time, though never the env's clock, and the token
10
+ only reads. It answers once the follower shows the gateway's current version, or says why it doesn't. The task's zone
11
+ is kept in the config beside what the follower reads, so a server restarted mid-run (``restore_zone``) brings the zone
12
+ back as the follower brings back the clock."""
13
+ from __future__ import annotations
14
+
15
+ import json
16
+ import os
17
+ import time
18
+ import uuid
19
+ from pathlib import Path
20
+ from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
21
+
22
+ from ..computer import clock as follower
23
+ from ..computer.errors import InvalidArgument, TargetUnavailable
24
+
25
+
26
+ def follows() -> bool:
27
+ """Whether this agent's image runs the clock follower."""
28
+ return follower.follows()
29
+
30
+
31
+ def write_config(watch_url: str, name: str, read_token: str, timezone: str | None = None) -> int:
32
+ """The follower's config, with the task's ``timezone`` for ``restore_zone``, written beside its place and renamed
33
+ into it, so the follower, which reads it every quarter second, never reads half of one; readable by this user and
34
+ the follower's group alone. When it was
35
+ written (``st_mtime_ns``), which a status must postdate to be of this config; 0 when the config was this one
36
+ already, which the follower goes on following without writing its status anew."""
37
+ path = Path(follower.CONFIG)
38
+ raw = json.dumps({"watch_url": watch_url, "name": name, "token": read_token,
39
+ **({"timezone": timezone} if timezone else {})}).encode()
40
+ try:
41
+ if path.read_bytes() == raw:
42
+ return 0
43
+ except OSError:
44
+ pass
45
+ staged = path.with_name(f"{path.name}.{uuid.uuid4().hex}")
46
+ fd = os.open(staged, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640)
47
+ try:
48
+ with os.fdopen(fd, "wb") as f:
49
+ f.write(raw)
50
+ os.chmod(staged, 0o640)
51
+ os.replace(staged, path)
52
+ except BaseException:
53
+ staged.unlink(missing_ok=True)
54
+ raise
55
+ return path.stat().st_mtime_ns
56
+
57
+
58
+ def set_zone(timezone: str) -> str:
59
+ """The task's zone for every program this server starts from now on: ``TZ`` in its environment, which a started
60
+ program inherits; this server's own records keep UTC timestamps either way."""
61
+ zone = timezone.strip()
62
+ try:
63
+ ZoneInfo(zone)
64
+ except (ZoneInfoNotFoundError, ValueError) as e:
65
+ raise InvalidArgument(f"timezone must be an IANA name such as 'America/Chicago', got {timezone!r}") from e
66
+ os.environ["TZ"] = zone
67
+ time.tzset()
68
+ return zone
69
+
70
+
71
+ def restore_zone() -> str | None:
72
+ """The task's zone ``sync_time`` saved, set again for what this server starts: called when it starts, so one that
73
+ restarts mid-run keeps the zone, as the follower keeps the clock. None when there's none, or it isn't a zone."""
74
+ try:
75
+ zone = json.loads(Path(follower.CONFIG).read_text()).get("timezone")
76
+ except (OSError, ValueError, AttributeError):
77
+ return None
78
+ if not isinstance(zone, str) or not zone:
79
+ return None
80
+ try:
81
+ return set_zone(zone)
82
+ except InvalidArgument:
83
+ return None
84
+
85
+
86
+ async def sync_time(env_get_time_url: str, timezone: str | None = None, watch_url: str | None = None,
87
+ name: str | None = None, read_token: str | None = None) -> dict:
88
+ """``clock/v1``'s ``sync_time`` on an agent: the follower configured to follow the gateway at ``watch_url`` as
89
+ ``name`` with ``read_token``, the task's ``timezone`` set for what this server starts, and an answer once the
90
+ follower shows the gateway's version for that config, never what it showed of one before. ``env_get_time_url`` is taken as every server takes it and not used: the
91
+ follower reads the gateway's watch, not its time."""
92
+ if not follows():
93
+ raise TargetUnavailable("this agent's image doesn't run the clock follower")
94
+ if not (watch_url and name and read_token):
95
+ raise InvalidArgument("an agent follows the clock with its watch_url, name and read_token, which "
96
+ "sync_env_clock sends; this request names "
97
+ + (", ".join(k for k, v in (("watch_url", watch_url), ("name", name),
98
+ ("read_token", read_token)) if v) or "none of them"))
99
+ zone = set_zone(timezone) if timezone is not None else os.environ.get("TZ") or "UTC"
100
+ written = write_config(watch_url, name, read_token, zone)
101
+ shown = await follower.following("this agent's clock follower", follower.CONNECT_WAIT_S, url=watch_url, name=name, since_ns=written)
102
+ return {"synced": True, "timezone": zone, "env_get_time_url": env_get_time_url, "follower": shown}
@@ -134,6 +134,18 @@ class BundleSkillRequest(ExtensionRequest):
134
134
  skill_bundle: SkillBundle
135
135
 
136
136
 
137
+ class ClockSyncTimeRequest(ExtensionRequest):
138
+ """clock/v1's ``sync_time`` on an agent: what every server's takes, ``env_get_time_url`` and ``timezone``, and the
139
+ config of the follower an agent runs itself, the gateway's watch URL as its sandbox reaches it, the name the
140
+ gateway knows it by and its read token."""
141
+
142
+ env_get_time_url: str
143
+ timezone: str | None = None
144
+ watch_url: str | None = None
145
+ name: str | None = None
146
+ read_token: str | None = None
147
+
148
+
137
149
  class SkillAddResponse(ExtensionResponse):
138
150
  name: str
139
151
 
@@ -1345,6 +1357,25 @@ TRIGGERS_V1 = ExtensionDefinition(
1345
1357
  },
1346
1358
  )
1347
1359
 
1360
+ CLOCK_V1 = ExtensionDefinition(
1361
+ uri="urn:agentenv:clock/v1",
1362
+ description=(
1363
+ "Follow the env's clock: the agent's image runs the clock follower, so every program the agent runs reads "
1364
+ "the env's time. Served where the image has the follower."
1365
+ ),
1366
+ endpoint="/ext/clock",
1367
+ core_operations={
1368
+ "sync_time": _op(
1369
+ "sync_time",
1370
+ "POST",
1371
+ "/ext/clock/sync-time",
1372
+ SDK,
1373
+ request_model=ClockSyncTimeRequest,
1374
+ response_required=("synced", "timezone", "follower"),
1375
+ ),
1376
+ },
1377
+ )
1378
+
1348
1379
  INSTALL_V1 = ExtensionDefinition(
1349
1380
  uri="urn:agentenv:install/v1",
1350
1381
  description="Declare commands for installing the agent into an existing target.",
@@ -1392,6 +1423,7 @@ STANDARD_EXTENSIONS: Mapping[str, ExtensionDefinition] = MappingProxyType(
1392
1423
  PEER_AGENTS_V1,
1393
1424
  ATTRIBUTION_PROBE_V1,
1394
1425
  TRIGGERS_V1,
1426
+ CLOCK_V1,
1395
1427
  INSTALL_V1,
1396
1428
  PROXY_V1,
1397
1429
  )
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import asyncio
6
+ import dataclasses
6
7
  import inspect
7
8
  import json
8
9
  import logging
@@ -39,6 +40,8 @@ from .extensions import (
39
40
  SKILL_CONFIG_V1,
40
41
  TRAJECTORY_V1,
41
42
  TRIGGERS_V1,
43
+ CLOCK_V1,
44
+ ClockSyncTimeRequest,
42
45
  ContextEventsTrajectoryRequest,
43
46
  ContextObjectTrajectoryRequest,
44
47
  ContextTrajectoryRequest,
@@ -59,6 +62,8 @@ from .extensions import (
59
62
  TriggerRegisterRequest,
60
63
  enable,
61
64
  )
65
+ from ..computer.errors import ComputerError
66
+ from . import clock as agent_clock
62
67
  from .peer_agents import PEER_MCP_PATH, PEER_MCP_SERVER_NAME, PeerAgents
63
68
  from .registry import RegisteredOperation, build_registry
64
69
  from .staging import STAGING_ENDPOINT, StagingStore, staging_routes
@@ -631,6 +636,7 @@ class _SdkServices:
631
636
  (TRIGGERS_V1.uri, "register"): self.triggers_register,
632
637
  (TRIGGERS_V1.uri, "decide"): self.triggers_decide,
633
638
  (TRIGGERS_V1.uri, "state"): self.triggers_state,
639
+ (CLOCK_V1.uri, "sync_time"): self.clock_sync_time,
634
640
  }
635
641
 
636
642
  async def agent_config_set(self, request: AgentConfig) -> dict[str, Any]:
@@ -876,6 +882,22 @@ class _SdkServices:
876
882
  async def triggers_state(self) -> dict[str, Any]:
877
883
  return self.trigger_engine.state()
878
884
 
885
+ async def clock_sync_time(self, request: ClockSyncTimeRequest) -> dict[str, Any]:
886
+ try:
887
+ return await agent_clock.sync_time(**request.model_dump())
888
+ except ComputerError as exc:
889
+ raise HTTPException(status_code=exc.STATUS, detail=f"{exc.CODE}: {exc}") from exc
890
+
891
+
892
+ def _with_clock(definition: _AgentDefinition) -> _AgentDefinition:
893
+ """``definition`` serving clock/v1 where the agent's image runs the clock follower, so every agent in such an
894
+ image follows the env's clock with no code of its own, and takes back the task's zone if it restarted mid-run;
895
+ unchanged elsewhere, or where the agent declares it."""
896
+ if not agent_clock.follows() or any(a.definition.uri == CLOCK_V1.uri for a in definition.extensions):
897
+ return definition
898
+ agent_clock.restore_zone() # a server restarted mid-run takes back the task's zone
899
+ return dataclasses.replace(definition, extensions=(*definition.extensions, ExtensionActivation(CLOCK_V1)))
900
+
879
901
 
880
902
  class DefaultExtensionHandlers:
881
903
  """Stable access to default implementations of SDK-owned operations."""
@@ -968,6 +990,7 @@ class A2AAgentApplication:
968
990
  "agent instance is already bound to an application; create a new "
969
991
  "agent instance for each application"
970
992
  )
993
+ definition = _with_clock(definition)
971
994
  self.agent = agent
972
995
  self.definition = definition
973
996
  self.rpc_path = _rpc_path(definition.identity.url)
@@ -47,11 +47,17 @@ def session_zone() -> str:
47
47
 
48
48
 
49
49
  def follower_status() -> dict:
50
+ return _status_written()[0]
51
+
52
+
53
+ def _status_written() -> tuple[dict, int]:
54
+ """The follower's status and when it wrote it (``st_mtime_ns``; 0 when there is none)."""
50
55
  try:
51
- status = json.loads(Path(STATUS).read_text())
56
+ path = Path(STATUS)
57
+ written, status = path.stat().st_mtime_ns, json.loads(path.read_text())
52
58
  except (OSError, ValueError):
53
- return {}
54
- return status if isinstance(status, dict) else {}
59
+ return {}, 0
60
+ return (status, written) if isinstance(status, dict) else ({}, 0)
55
61
 
56
62
 
57
63
  def gateway_version(watch_url: str) -> str:
@@ -60,7 +66,10 @@ def gateway_version(watch_url: str) -> str:
60
66
  return json.loads(answer.read())["version"]
61
67
 
62
68
 
63
- def _why(status: dict, current: Optional[str], unread: Optional[str]) -> str:
69
+ def _why(status: dict, current: Optional[str], unread: Optional[str], stale: bool = False) -> str:
70
+ if stale:
71
+ return (f"it still shows the config it had, the gateway at {status.get('url')} as {status.get('name')!r}, "
72
+ f"not the one just written")
64
73
  if status.get("error"):
65
74
  return f"it can't reach the gateway at {status.get('url')}: {status['error']}"
66
75
  if not status.get("url"):
@@ -82,19 +91,35 @@ async def sync_time(env_get_time_url: str, timezone: Optional[str] = None) -> di
82
91
  if timezone is not None and timezone.strip() != zone:
83
92
  raise InvalidArgument(f"the task's clock is in {timezone.strip()!r} and this computer's session in {zone!r}; "
84
93
  f"deploy it with computer_settings.timezone = {timezone.strip()!r}")
85
- deadline = time.monotonic() + CONNECT_WAIT_S
94
+ follower = await following("this computer's clock follower")
95
+ return {"synced": True, "timezone": zone, "env_get_time_url": env_get_time_url, "follower": follower}
96
+
97
+
98
+ async def following(whose: str, wait_s: float = CONNECT_WAIT_S, *, url: Optional[str] = None,
99
+ name: Optional[str] = None, since_ns: int = 0) -> dict:
100
+ """The follower's status once it shows the gateway's current version; TargetUnavailable saying why ``whose``
101
+ doesn't within ``wait_s``. A computer's ``sync_time`` and an agent's (``agentenv_protocol.a2a_agent.clock``) both answer
102
+ with it. An agent's, which has just written the follower's config, names it: only a status of that ``url`` and
103
+ ``name`` the follower wrote since ``since_ns`` counts, so what it showed of a config before is never taken for
104
+ this one's."""
105
+ deadline = time.monotonic() + wait_s
106
+
107
+ def read() -> tuple[dict, bool]:
108
+ status, written = _status_written()
109
+ stale = bool(status) and (written < since_ns or (url is not None and status.get("url") != url)
110
+ or (name is not None and status.get("name") != name))
111
+ return status, stale
112
+
86
113
  while True:
87
- status, current, unread = follower_status(), None, None
88
- if status.get("connected") and status.get("url"):
114
+ (status, stale), current, unread = read(), None, None
115
+ if not stale and status.get("connected") and status.get("url"):
89
116
  try:
90
117
  current = await asyncio.to_thread(gateway_version, status["url"])
91
118
  except Exception as e: # noqa: BLE001 - away or answering something else: said as why, tried again
92
119
  unread = f"{type(e).__name__}: {e}"[:300]
93
- status = follower_status()
94
- if current is not None and status.get("connected") and status.get("version") == current:
95
- return {"synced": True, "timezone": zone, "env_get_time_url": env_get_time_url,
96
- "follower": {key: status.get(key) for key in ("name", "url", "version", "armed")}}
120
+ status, stale = read()
121
+ if not stale and current is not None and status.get("connected") and status.get("version") == current:
122
+ return {key: status.get(key) for key in ("name", "url", "version", "armed")}
97
123
  if time.monotonic() >= deadline:
98
- raise TargetUnavailable("this computer's clock follower isn't following the gateway: "
99
- + _why(status, current, unread))
124
+ raise TargetUnavailable(f"{whose} isn't following the gateway: " + _why(status, current, unread, stale))
100
125
  await asyncio.sleep(0.1)
@@ -0,0 +1,181 @@
1
+ """An agent's side of clock/v1: in an image that runs the clock follower, every AgentEnvAgent serves sync_time with no
2
+ code of its own; called by sync_env_clock, it writes the follower's config from the request, sets the task's zone for
3
+ what the server starts, and answers once the follower shows the gateway's current version, or says why it doesn't."""
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import os
8
+ import stat
9
+ import threading
10
+ import time
11
+
12
+ import pytest
13
+ from starlette.testclient import TestClient
14
+
15
+ from agentenv_protocol.a2a_agent import (
16
+ CLOCK_V1,
17
+ AgentEnvAgent,
18
+ AgentIdentity,
19
+ TaskRequest,
20
+ TaskResult,
21
+ a2a_agent,
22
+ )
23
+ from agentenv_protocol.computer import clock as follower
24
+
25
+ REQUEST = {"env_get_time_url": "http://gw/clock/time", "watch_url": "http://gw/clock/watch", "name": "agent-solver",
26
+ "read_token": "token"}
27
+
28
+
29
+ @pytest.fixture
30
+ def image(tmp_path, monkeypatch):
31
+ """An image that runs the follower: its config and status under ``tmp_path``, the gateway at version b:3."""
32
+ (tmp_path / "clock-follower").write_text("")
33
+ monkeypatch.setattr(follower, "FOLLOWER", str(tmp_path / "clock-follower"))
34
+ monkeypatch.setattr(follower, "DISK_GUEST", str(tmp_path / "image.env"))
35
+ monkeypatch.setattr(follower, "CONFIG", str(tmp_path / "follower.json"))
36
+ monkeypatch.setattr(follower, "STATUS", str(tmp_path / "status.json"))
37
+ monkeypatch.setattr(follower, "CONNECT_WAIT_S", 0.3)
38
+ monkeypatch.setattr(follower, "gateway_version", lambda url: "b:3")
39
+ monkeypatch.setenv("TZ", "UTC")
40
+ yield tmp_path
41
+ time.tzset()
42
+
43
+
44
+ def _status(image, **status) -> None:
45
+ (image / "status.json").write_text(json.dumps(status))
46
+
47
+
48
+ def _follows_the_next_config(image, **status) -> threading.Thread:
49
+ """A follower that, as the real one, writes its status once it reads a config other than the one it had."""
50
+ config = image / "follower.json"
51
+ before = config.read_bytes() if config.exists() else None
52
+
53
+ def run() -> None:
54
+ deadline = time.monotonic() + 5
55
+ while time.monotonic() < deadline:
56
+ if config.exists() and config.read_bytes() != before:
57
+ _status(image, **status)
58
+ return
59
+ time.sleep(0.01)
60
+
61
+ thread = threading.Thread(target=run, daemon=True)
62
+ thread.start()
63
+ return thread
64
+
65
+
66
+ def _app(**declared):
67
+ @a2a_agent(identity=AgentIdentity(name="clocked", description="test", version="1"), **declared)
68
+ class Agent(AgentEnvAgent):
69
+ async def run(self, request: TaskRequest) -> TaskResult:
70
+ return TaskResult.text("ok")
71
+
72
+ return TestClient(Agent().create_app())
73
+
74
+
75
+ def _clock(client) -> dict | None:
76
+ card = client.get("/.well-known/agent.json").json()
77
+ return next((e for e in card["capabilities"]["extensions"] if e["uri"] == CLOCK_V1.uri), None)
78
+
79
+
80
+ def test_every_agent_in_an_image_with_the_follower_serves_sync_time(image):
81
+ with _app() as client:
82
+ served = _clock(client)
83
+
84
+ assert served is not None
85
+ request = served["params"]["methods"]["sync_time"]["request"]
86
+ assert request == {"required": ["env_get_time_url"], "optional": ["timezone", "watch_url", "name", "read_token"]}
87
+
88
+
89
+ def test_an_agent_in_an_image_without_the_follower_serves_no_clock(image, monkeypatch):
90
+ monkeypatch.setattr(follower, "FOLLOWER", str(image / "absent"))
91
+ with _app() as client:
92
+ assert _clock(client) is None
93
+
94
+
95
+ def test_sync_time_writes_the_followers_config_sets_the_zone_and_answers_once_it_follows(image):
96
+ _follows_the_next_config(image, connected=True, url="http://gw/clock/watch", name="agent-solver", version="b:3",
97
+ armed=True)
98
+ with _app() as client:
99
+ answer = client.post("/ext/clock/sync-time", json={**REQUEST, "timezone": "America/Chicago"})
100
+
101
+ assert answer.status_code == 200, answer.text
102
+ assert answer.json() == {"synced": True, "timezone": "America/Chicago", "env_get_time_url": "http://gw/clock/time",
103
+ "follower": {"name": "agent-solver", "url": "http://gw/clock/watch", "version": "b:3",
104
+ "armed": True}}
105
+ config = image / "follower.json"
106
+ assert json.loads(config.read_text()) == {"watch_url": "http://gw/clock/watch", "name": "agent-solver",
107
+ "token": "token", "timezone": "America/Chicago"}
108
+ assert stat.S_IMODE(config.stat().st_mode) == 0o640
109
+ assert os.environ["TZ"] == "America/Chicago" and time.strftime("%Z") in {"CST", "CDT"}
110
+ assert [p.name for p in image.iterdir() if p.name.startswith("follower.json.")] == []
111
+
112
+
113
+ def test_a_follower_behind_the_gateway_is_named(image):
114
+ _follows_the_next_config(image, connected=True, url="http://gw/clock/watch", name="agent-solver", version="b:2")
115
+ with _app() as client:
116
+ answer = client.post("/ext/clock/sync-time", json=REQUEST)
117
+
118
+ assert answer.status_code == 404
119
+ assert "this agent's clock follower isn't following the gateway: it shows the gateway's version 'b:2'" in answer.text
120
+
121
+
122
+ @pytest.mark.parametrize("missing", ["watch_url", "name", "read_token"])
123
+ def test_a_request_without_the_followers_config_is_refused_and_nothing_is_written(image, missing):
124
+ with _app() as client:
125
+ answer = client.post("/ext/clock/sync-time", json={k: v for k, v in REQUEST.items() if k != missing})
126
+
127
+ assert answer.status_code == 400 and "watch_url, name and read_token" in answer.text
128
+ assert not (image / "follower.json").exists()
129
+
130
+
131
+ def test_a_zone_that_isnt_one_is_refused(image):
132
+ with _app() as client:
133
+ answer = client.post("/ext/clock/sync-time", json={**REQUEST, "timezone": "Mars/Olympus"})
134
+
135
+ assert answer.status_code == 400 and "IANA" in answer.text and os.environ["TZ"] == "UTC"
136
+
137
+
138
+ @pytest.mark.parametrize("before", [
139
+ {"url": "http://old-gw/clock/watch", "name": "agent-solver"}, # another gateway: it may answer the same version
140
+ {"url": "http://gw/clock/watch", "name": "agent-solver"}, # this one, under the token the config replaced
141
+ ])
142
+ def test_what_the_follower_showed_of_its_config_before_never_passes_for_the_new_one(image, before):
143
+ _status(image, connected=True, version="b:3", armed=True, **before)
144
+ with _app() as client:
145
+ answer = client.post("/ext/clock/sync-time", json=REQUEST)
146
+
147
+ assert answer.status_code == 404
148
+ assert "still shows the config it had" in answer.text
149
+
150
+
151
+ def test_the_config_it_already_follows_resent_answers_from_its_status(image):
152
+ with _app() as client:
153
+ _follows_the_next_config(image, connected=True, url="http://gw/clock/watch", name="agent-solver",
154
+ version="b:3")
155
+ assert client.post("/ext/clock/sync-time", json=REQUEST).status_code == 200
156
+ answer = client.post("/ext/clock/sync-time", json=REQUEST) # the follower writes nothing anew
157
+
158
+ assert answer.status_code == 200, answer.text
159
+
160
+
161
+ def test_a_server_restarted_mid_run_takes_back_the_tasks_zone(image, monkeypatch):
162
+ _follows_the_next_config(image, connected=True, url="http://gw/clock/watch", name="agent-solver", version="b:3")
163
+ with _app() as client:
164
+ assert client.post("/ext/clock/sync-time", json={**REQUEST, "timezone": "America/Chicago"}).status_code == 200
165
+ monkeypatch.setenv("TZ", "UTC") # the restarted server's environment: the image's, without the task's zone
166
+ time.tzset()
167
+
168
+ with _app() as client: # starting it again, as supervisord does after the server dies
169
+ assert client.get("/.well-known/agent.json").status_code == 200
170
+
171
+ assert os.environ["TZ"] == "America/Chicago" and time.strftime("%Z") in {"CST", "CDT"}
172
+
173
+
174
+ @pytest.mark.parametrize("config", ['{"watch_url": "u", "name": "n", "token": "t"}', '{"timezone": "Mars/Olympus"}',
175
+ "not json", None])
176
+ def test_a_server_starting_without_a_saved_zone_keeps_its_own(image, monkeypatch, config):
177
+ if config is not None:
178
+ (image / "follower.json").write_text(config)
179
+ with _app() as client:
180
+ assert client.get("/.well-known/agent.json").status_code == 200
181
+ assert os.environ["TZ"] == "UTC"