agentenv-framework-protocol 0.1.550__tar.gz → 0.1.553__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 (196) hide show
  1. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/PKG-INFO +1 -1
  2. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/pyproject.toml +1 -1
  3. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/cdp.py +17 -7
  4. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/contexts.py +11 -7
  5. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/control.py +88 -32
  6. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/log.py +3 -2
  7. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_cdp.py +87 -1
  8. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_contexts.py +62 -1
  9. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_log.py +15 -0
  10. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_browser.py +114 -5
  11. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/.gitignore +0 -0
  12. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/LICENSE +0 -0
  13. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/NOTICE +0 -0
  14. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/README.md +0 -0
  15. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/THIRD_PARTY_NOTICES.md +0 -0
  16. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/__init__.py +0 -0
  17. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/advanced_agent.py +0 -0
  18. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/basic_agent.py +0 -0
  19. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/custom_extensions_agent.py +0 -0
  20. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/multimodal_agent.py +0 -0
  21. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/reference_model.py +0 -0
  22. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/streaming_agent.py +0 -0
  23. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/.gitignore +0 -0
  24. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/Dockerfile +0 -0
  25. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/Dockerfile.dockerignore +0 -0
  26. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/README.md +0 -0
  27. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/data/seed.json +0 -0
  28. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/env.toml +0 -0
  29. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/site.py +0 -0
  30. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/index.html +0 -0
  31. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/package-lock.json +0 -0
  32. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/package.json +0 -0
  33. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/src/main.js +0 -0
  34. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/src/style.css +0 -0
  35. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/examples/website/notes/web/vite.config.js +0 -0
  36. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/__init__.py +0 -0
  37. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
  38. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
  39. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  40. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
  41. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
  42. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  43. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
  44. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  45. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  46. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  47. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
  48. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/agent_env_environment.py +0 -0
  49. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/client.py +0 -0
  50. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/__init__.py +0 -0
  51. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_declare.py +0 -0
  52. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_desktop.py +0 -0
  53. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_job.py +0 -0
  54. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_linux.py +0 -0
  55. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_load.py +0 -0
  56. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_macos.py +0 -0
  57. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_reaping.py +0 -0
  58. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  59. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  60. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_windows.py +0 -0
  61. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  62. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/_x11.py +0 -0
  63. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/app.py +0 -0
  64. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/app_data.py +0 -0
  65. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  66. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/apps.py +0 -0
  67. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/card.py +0 -0
  68. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/checks.py +0 -0
  69. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/clock.py +0 -0
  70. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  71. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  72. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  73. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  74. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  75. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  76. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  77. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  78. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  79. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  80. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/dataplane.py +0 -0
  81. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/driver.py +0 -0
  82. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/errors.py +0 -0
  83. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/extensions.py +0 -0
  84. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/frames.py +0 -0
  85. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/keys.py +0 -0
  86. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/launch.py +0 -0
  87. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/manifest.py +0 -0
  88. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/operations.py +0 -0
  89. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/platform.py +0 -0
  90. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/prefix.py +0 -0
  91. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/queue.py +0 -0
  92. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/recording.py +0 -0
  93. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/results.py +0 -0
  94. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  95. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/runtime.py +0 -0
  96. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/seed.py +0 -0
  97. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/serve.py +0 -0
  98. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/serve_app.py +0 -0
  99. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/served.py +0 -0
  100. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/session.py +0 -0
  101. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/settings.py +0 -0
  102. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/skill.py +0 -0
  103. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/spaces.py +0 -0
  104. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/svc.py +0 -0
  105. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/computer/tools.py +0 -0
  106. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/errors.py +0 -0
  107. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/manifest.py +0 -0
  108. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/passthrough.py +0 -0
  109. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/preflight.py +0 -0
  110. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/tool_access.py +0 -0
  111. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/tool_client.py +0 -0
  112. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/tool_context.py +0 -0
  113. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/transfers.py +0 -0
  114. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/types.py +0 -0
  115. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/__init__.py +0 -0
  116. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/clock.py +0 -0
  117. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/conformance.py +0 -0
  118. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/environment.py +0 -0
  119. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/errors.py +0 -0
  120. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/forwarding.py +0 -0
  121. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/readiness.py +0 -0
  122. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/routes.py +0 -0
  123. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website/session.py +0 -0
  124. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  125. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/data.py +0 -0
  126. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/devtools.py +0 -0
  127. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/environment.py +0 -0
  128. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/network.py +0 -0
  129. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/recording.py +0 -0
  130. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/scope.py +0 -0
  131. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  132. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/src/agentenv_protocol/website_browser/stream.py +0 -0
  133. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/computer_fake.py +0 -0
  134. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/probe_fake.py +0 -0
  135. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_agent.py +0 -0
  136. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_agent_examples.py +0 -0
  137. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_cdp_config.py +0 -0
  138. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_object_transfers.py +0 -0
  139. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_peer_agents.py +0 -0
  140. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_proxy.py +0 -0
  141. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_staging.py +0 -0
  142. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_a2a_trajectory_log.py +0 -0
  143. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_agent_env_environment.py +0 -0
  144. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_data.py +0 -0
  145. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_network.py +0 -0
  146. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_recording.py +0 -0
  147. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_browser_state.py +0 -0
  148. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_client.py +0 -0
  149. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_app_data.py +0 -0
  150. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_app_server.py +0 -0
  151. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_clock.py +0 -0
  152. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_conformance.py +0 -0
  153. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_conformance_attempts.py +0 -0
  154. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_conformance_checks.py +0 -0
  155. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_conformance_page.py +0 -0
  156. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_conformance_recording.py +0 -0
  157. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_dataplane.py +0 -0
  158. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_declare.py +0 -0
  159. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_driver.py +0 -0
  160. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_driver_keys.py +0 -0
  161. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_extensions.py +0 -0
  162. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_frames.py +0 -0
  163. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_macos.py +0 -0
  164. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_page.py +0 -0
  165. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_queue.py +0 -0
  166. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_recording.py +0 -0
  167. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_seed.py +0 -0
  168. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_serve.py +0 -0
  169. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_served.py +0 -0
  170. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_session_windows.py +0 -0
  171. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_spaces.py +0 -0
  172. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_svc_forward.py +0 -0
  173. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_tool_prefix.py +0 -0
  174. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_computer_windows_driver.py +0 -0
  175. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_control_token.py +0 -0
  176. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_data_objects.py +0 -0
  177. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_devtools_pipe.py +0 -0
  178. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_errors.py +0 -0
  179. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_extension_methods.py +0 -0
  180. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_intake.py +0 -0
  181. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_manifest.py +0 -0
  182. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_preflight.py +0 -0
  183. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_access.py +0 -0
  184. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_annotations.py +0 -0
  185. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_client.py +0 -0
  186. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_context.py +0 -0
  187. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_context_fastmcp.py +0 -0
  188. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_tool_context_injection.py +0 -0
  189. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_api.py +0 -0
  190. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_conformance.py +0 -0
  191. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_environment.py +0 -0
  192. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_forwarding.py +0 -0
  193. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_live.py +0 -0
  194. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_mcp.py +0 -0
  195. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/tests/test_website_notes_example.py +0 -0
  196. {agentenv_framework_protocol-0.1.550 → agentenv_framework_protocol-0.1.553}/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.550
3
+ Version: 0.1.553
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.550"
3
+ version = "0.1.553"
4
4
  description = "Open data-plane protocol and server SDK for agent environments."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -275,11 +275,12 @@ class Relay:
275
275
  who connected when, and what the guard did to their commands. ``dialogs_answered`` says agentenv answers the
276
276
  browser's dialogs itself. With a ``log``, each command is an entry in it, on the tab its session is on, and
277
277
  ``control``, agentenv's own connection, tells its tab's URL, whether a password field has focus there, and what
278
- causes the tab events a command brings. An agent's tool call a driver serves through a CDP user's connections,
279
- such as Playwright MCP's, is an entry too, which that user's commands are credited to while it's open. With
280
- ``contexts``, a context a connection makes is leased to its user, only one it made may it dispose, and a lease's
281
- downloads stay in its folder. A connection is scoped to a lease or to the default context, and sees only its scope
282
- and the contexts its user made (``scope``)."""
278
+ causes the tab events a command brings; an agent's disposal of a context waits for ``control``'s own pages open
279
+ there to close (``BrowserControl.disposing``), and its connection's later commands wait with it. An agent's tool
280
+ call a driver serves through a CDP user's connections, such as Playwright MCP's, is an entry too, which that user's
281
+ commands are credited to while it's open. With ``contexts``, a context a connection makes is leased to its user,
282
+ only one it made may it dispose, and a lease's downloads stay in its folder. A connection is scoped to a lease or to
283
+ the default context, and sees only its scope and the contexts its user made (``scope``)."""
283
284
 
284
285
  def __init__(self, devtools: DevToolsPipe, *, dialogs_answered: bool = False, log: Optional[BrowserLog] = None,
285
286
  control: Optional[BrowserControl] = None, contexts: Optional[Contexts] = None) -> None:
@@ -371,8 +372,12 @@ class Relay:
371
372
  for task in [*connection.commands, sending]:
372
373
  task.cancel()
373
374
  await asyncio.gather(*connection.commands, sending, return_exceptions=True)
374
- with contextlib.suppress(Exception):
375
- await self.devtools.call("Target.detachFromTarget", {"sessionId": session})
375
+ # Its detach disposes the contexts it made to end on detach, so it waits as a dispose does.
376
+ async with contextlib.AsyncExitStack() as disposal:
377
+ for made in connection.ends_on_detach if self.control is not None else ():
378
+ await disposal.enter_async_context(self.control.disposing(made))
379
+ with contextlib.suppress(Exception):
380
+ await self.devtools.call("Target.detachFromTarget", {"sessionId": session})
376
381
  self._detached(connection)
377
382
 
378
383
  def ended(self) -> None:
@@ -400,6 +405,7 @@ class Relay:
400
405
  logged = self._begin(connection, session, method, params)
401
406
  answer, guarded = {"error": {"code": SERVER_ERROR, "message": ENDED_UNANSWERED}}, None
402
407
  sending: Optional[asyncio.Future] = None
408
+ disposal = contextlib.AsyncExitStack()
403
409
  replied = False
404
410
 
405
411
  def reply(answer: dict) -> None:
@@ -423,6 +429,9 @@ class Relay:
423
429
  elif verdict.action != "send":
424
430
  answer = {"result": {}}
425
431
  else:
432
+ if method == ENDS_CONTEXT and self.control is not None and \
433
+ isinstance(context := verdict.params.get("browserContextId"), str):
434
+ await disposal.enter_async_context(self.control.disposing(context))
426
435
  sending = asyncio.ensure_future(self.devtools.request(method, verdict.params, session_id=session,
427
436
  answered=reply))
428
437
  await asyncio.sleep(0)
@@ -441,6 +450,7 @@ class Relay:
441
450
  finally:
442
451
  if sending is not None and not sending.done():
443
452
  sending.cancel()
453
+ await disposal.aclose()
444
454
  if logged is not None:
445
455
  logged.finish(answer, guarded)
446
456
 
@@ -6,6 +6,7 @@ enforced: the CDP addresses agents hold still see every context."""
6
6
  from __future__ import annotations
7
7
 
8
8
  import asyncio
9
+ import collections
9
10
  import contextlib
10
11
  import logging
11
12
  import re
@@ -85,7 +86,8 @@ class Contexts:
85
86
  self.on_made: list[Callable[[Lease, Optional[str]], None]] = []
86
87
  self._made: dict[str, int] = {}
87
88
  self._tasks: set[asyncio.Future] = set()
88
- self._lock = asyncio.Lock()
89
+ #: A lock per label, so leasing or releasing one waits only for another of the same label.
90
+ self._locks: dict[str, asyncio.Lock] = collections.defaultdict(asyncio.Lock)
89
91
 
90
92
  def __iter__(self):
91
93
  return iter(list(self.leases.values()))
@@ -110,7 +112,7 @@ class Contexts:
110
112
  """The lease ``label``: the one leased under it before, as a retried step finds it, else a new context, its
111
113
  downloads going to its own folder. A task's label is checked; one ``made_by`` an agent may start ``agent-``,
112
114
  as a load of a snapshot restores such leases."""
113
- async with self._lock:
115
+ async with self._locks[label]:
114
116
  if (lease := self.leases.get(label)) is None:
115
117
  if problem := label_problem(label, by_task=made_by == TASK):
116
118
  raise InvalidArgument(problem)
@@ -133,15 +135,17 @@ class Contexts:
133
135
  return lease
134
136
 
135
137
  async def release(self, label: str) -> bool:
136
- """The lease ``label`` ended: its context disposed, which closes its tabs, and its folder deleted. Whether
137
- there was one: releasing a label that isn't leased does nothing, so a retried step is harmless."""
138
- async with self._lock:
138
+ """The lease ``label`` ended: its context disposed once agentenv's own pages in it have closed, which closes its
139
+ tabs, and its folder deleted. Whether there was one: releasing a label that isn't leased does nothing, so a
140
+ retried step is harmless."""
141
+ async with self._locks[label]:
139
142
  if (lease := self.leases.pop(label, None)) is None:
140
143
  return False
141
144
  self.control.closing_context(lease.id)
142
145
  self._ended(lease)
143
- with contextlib.suppress(DevToolsError):
144
- await self.devtools.call("Target.disposeBrowserContext", {"browserContextId": lease.id})
146
+ async with self.control.disposing(lease.id):
147
+ with contextlib.suppress(DevToolsError):
148
+ await self.devtools.call("Target.disposeBrowserContext", {"browserContextId": lease.id})
145
149
  await asyncio.to_thread(shutil.rmtree, lease.folder(self.home()), True)
146
150
  return True
147
151
 
@@ -15,7 +15,7 @@ from typing import Any, Awaitable, Callable, Optional
15
15
  from urllib.parse import urlsplit
16
16
 
17
17
  from .log import ACTOR, KEY_FIELDS, TYPING_METHODS, BrowserLog, Causes, caused, log_time, redact_url
18
- from ..computer.errors import DeviceUnavailable, InvalidArgument
18
+ from ..computer.errors import DeviceUnavailable, InvalidArgument, TargetUnavailable
19
19
  from .devtools import DevToolsError, DevToolsPipe
20
20
  from .shapes import (ClosedTab, Cookie, CookieToSet, Dialog, Download, OpenTab, OriginStorage, StartTab, StorageItem,
21
21
  origin_of)
@@ -33,6 +33,8 @@ PIN_TIMEOUT_S = 10.0
33
33
  ARRIVAL_POLL_S = 0.05
34
34
  #: How long a start tab on a site the env doesn't serve may take to load before it's left loading.
35
35
  LIVE_START_TAB_TIMEOUT_S = 30.0
36
+ #: How long a start tab's move within its document may take to land after the browser answers it, before its reload.
37
+ MOVE_WITHIN_S = 5.0
36
38
  #: How a start tab settled.
37
39
  LOADED, FAILED, TIMED_OUT = "loaded", "failed", "timed_out"
38
40
  #: How much of a download each read hashes.
@@ -108,6 +110,10 @@ class BrowserControl:
108
110
  self.dialog_log: list[dict] = []
109
111
  self._sessions: dict[str, str] = {}
110
112
  self._hidden: set[str] = set()
113
+ #: What each page of agentenv's own open now sets as it closes, with its context, None for the default one; and
114
+ #: the contexts being disposed, once per disposal under way, which open no more (``disposing``).
115
+ self._hidden_pages: dict[asyncio.Event, Optional[str]] = {}
116
+ self._disposing: list[str] = []
111
117
  self._closing: set[str] = set()
112
118
  self._open_dialogs: dict[str, dict] = {}
113
119
  self._answering: set[str] = set()
@@ -326,7 +332,8 @@ class BrowserControl:
326
332
  as ``site_of`` names them, an error status is too, or once it has been waited on ``own_timeout_s`` on such a
327
333
  site, else ``live_timeout_s``. Each tab's outcome, in order, kept though the browser has gone and the first
328
334
  can't come to the front. A page already loaded doesn't read cookies set after it, so a tab a load signed in
329
- shows it only once it loads again."""
335
+ shows it only once it loads again: a tab already on its URL's document, as a hash-routed page, is reloaded
336
+ there, since going to the URL alone only moves within the document (``_start_navigation``)."""
330
337
  if not urls:
331
338
  return []
332
339
  targets = [target for target, tab in self.tabs.items()
@@ -357,7 +364,8 @@ class BrowserControl:
357
364
  async def _start_load(self, target: str, url: str, site: Optional[str]) -> _StartLoad:
358
365
  """The tab ``target`` sent to ``url``, its navigation followed by what the browser says of it. The browser
359
366
  answers a navigation once it commits, which a page that never answers never does, so its answer is awaited
360
- apart, for as long as the tab is."""
367
+ apart, for as long as the tab is, and a navigation that stays in the tab's document is followed by a reload
368
+ (``_start_navigation``)."""
361
369
  session = next((s for s, t in self._sessions.items() if t == target), None)
362
370
  if session is None:
363
371
  raise DeviceUnavailable(f"the browser's tab {target} has no session to load a start tab in")
@@ -368,14 +376,43 @@ class BrowserControl:
368
376
  load.error = f"{type(e).__name__}: {e}"
369
377
  load.check()
370
378
  return load
371
- landed = asyncio.get_running_loop().create_future()
372
- self.causes.navigating(target, landed, _cause())
373
- load.navigating = asyncio.ensure_future(self.devtools.request("Page.navigate", {"url": url},
374
- session_id=session))
379
+ load.navigating = asyncio.ensure_future(self._start_navigation(target, load, session))
375
380
  load.navigating.add_done_callback(load.answered)
376
- load.navigating.add_done_callback(lambda done: _landed_at(landed, done))
377
381
  return load
378
382
 
383
+ async def _start_navigation(self, target: str, load: _StartLoad, session: str) -> dict:
384
+ """``load``'s tab sent to its URL, which the log says who asked for: the browser's answer. A tab already on the
385
+ URL's document, as a hash-routed page is, only moves within it, which loads nothing and names no loader, so the
386
+ page wouldn't read what a load just set: it's reloaded there once the move has landed, which the browser
387
+ answers before it does (else the reload loads where the tab was), the load taking its main frame's first
388
+ document after for its own, and the log that navigation for the reload."""
389
+ cause, landed = _cause(), asyncio.get_running_loop().create_future()
390
+ self.causes.navigating(target, landed, cause)
391
+ try:
392
+ answer = await self.devtools.request("Page.navigate", {"url": load.url}, session_id=session)
393
+ except BaseException:
394
+ landed.cancel()
395
+ raise
396
+ result = answer.get("result") or {}
397
+ if "error" in answer or result.get("errorText"):
398
+ landed.cancel()
399
+ return answer
400
+ landed.set_result(result.get("loaderId"))
401
+ if result.get("loaderId"):
402
+ return answer
403
+ with contextlib.suppress(asyncio.TimeoutError):
404
+ await asyncio.wait_for(load.moved.wait(), MOVE_WITHIN_S)
405
+ load.reloading = True
406
+ self.causes.navigates_next(target, cause)
407
+ try:
408
+ reloaded = await self.devtools.request("Page.reload", {}, session_id=session)
409
+ except BaseException:
410
+ self.causes.navigated_nowhere(target, cause)
411
+ raise
412
+ if "error" in reloaded:
413
+ self.causes.navigated_nowhere(target, cause)
414
+ return reloaded
415
+
379
416
  async def _settled(self, target: str, load: _StartLoad, timeout_s: float) -> dict:
380
417
  """``load``'s outcome once it settles, or once it has been waited on ``timeout_s``."""
381
418
  try:
@@ -550,17 +587,38 @@ class BrowserControl:
550
587
  @contextlib.asynccontextmanager
551
588
  async def hidden_page(self, url: str = "about:blank", context: Optional[str] = None) -> AsyncIterator[str]:
552
589
  """A page of agentenv's own for reading state, in the context ``context``, else the default one, in no window
553
- and never in the record; its session's id. It's closed after."""
554
- target = (await self.devtools.call("Target.createTarget", {
555
- "url": url, "hidden": True, "background": True,
556
- **({"browserContextId": context} if context else {})}))["targetId"]
557
- self._hidden.add(target)
558
- self.tabs.pop(target, None)
590
+ and never in the record; its session's id. It's closed after, before its context is disposed;
591
+ TargetUnavailable for a context being disposed."""
592
+ if context in self._disposing:
593
+ raise TargetUnavailable(f"the context {self.other_contexts.get(context, context)!r} is being disposed")
594
+ closed = asyncio.Event()
595
+ self._hidden_pages[closed] = context
559
596
  try:
560
- yield (await self.devtools.call("Target.attachToTarget", {"targetId": target, "flatten": True}))["sessionId"]
597
+ target = (await self.devtools.call("Target.createTarget", {
598
+ "url": url, "hidden": True, "background": True, **_in(context)}))["targetId"]
599
+ self._hidden.add(target)
600
+ self.tabs.pop(target, None)
601
+ try:
602
+ attached = await self.devtools.call("Target.attachToTarget", {"targetId": target, "flatten": True})
603
+ yield attached["sessionId"]
604
+ finally:
605
+ with contextlib.suppress(ConnectionError, DevToolsError):
606
+ await self.devtools.call("Target.closeTarget", {"targetId": target})
561
607
  finally:
562
- with contextlib.suppress(ConnectionError, DevToolsError):
563
- await self.devtools.call("Target.closeTarget", {"targetId": target})
608
+ del self._hidden_pages[closed]
609
+ closed.set()
610
+
611
+ @contextlib.asynccontextmanager
612
+ async def disposing(self, context: str) -> AsyncIterator[None]:
613
+ """The context ``context`` disposed within: from its start no page of agentenv's own opens in it, and it waits
614
+ for those open there to close, as Chromium crashes disposing a context that holds a hidden page."""
615
+ self._disposing.append(context)
616
+ try:
617
+ for closed in [closed for closed, of in self._hidden_pages.items() if of == context]:
618
+ await closed.wait()
619
+ yield
620
+ finally:
621
+ self._disposing.remove(context)
564
622
 
565
623
  async def active_tab(self, context: Optional[str] = None) -> Optional[str]:
566
624
  """The active tab of the context ``context``, else of the default one, as ``page_tab`` picks among its tabs."""
@@ -1039,6 +1097,8 @@ class BrowserControl:
1039
1097
  self._spawn(self._log_navigated(self.log.reserve(), log_time(), target, frame.get("url", ""),
1040
1098
  frame.get("loaderId")))
1041
1099
  if (load := self._loading.get(session)) is not None and not frame.get("parentId") and frame.get("loaderId"):
1100
+ if load.reloading and load.loader is None:
1101
+ load.loader = frame["loaderId"]
1042
1102
  load.commits.append(frame["loaderId"])
1043
1103
  load.check()
1044
1104
 
@@ -1050,14 +1110,18 @@ class BrowserControl:
1050
1110
 
1051
1111
  def _on_Page_navigatedWithinDocument(self, params: dict, session: Optional[str]) -> None:
1052
1112
  """A tab's page moving to another URL of its document, a fragment or its history API: a command's, when one
1053
- asked for it, else its page's."""
1113
+ asked for it, else its page's; a start tab's move before its reload."""
1054
1114
  target = self._sessions.get(session)
1115
+ if (load := self._loading.get(session)) is not None and params.get("frameId") == target:
1116
+ load.moved.set()
1055
1117
  if self.log is not None and target in self.tabs and params.get("frameId") == target:
1056
1118
  self._spawn(self._log_navigated(self.log.reserve(), log_time(), target, params.get("url", ""), False))
1057
1119
 
1058
1120
  def _on_Network_requestWillBeSent(self, params: dict, session: Optional[str]) -> None:
1059
1121
  if (load := self._loading.get(session)) is not None and params.get("type") == "Document":
1060
1122
  load.requests[params["requestId"]] = params.get("loaderId", "")
1123
+ if load.reloading and load.loader is None and params.get("frameId") == self._sessions.get(session):
1124
+ load.loader = params.get("loaderId") or None
1061
1125
 
1062
1126
  def _on_Network_responseReceived(self, params: dict, session: Optional[str]) -> None:
1063
1127
  if (load := self._loading.get(session)) is not None and params.get("type") == "Document" and \
@@ -1228,7 +1292,9 @@ class _StartLoad:
1228
1292
  commits in order, the loads that fired after a commit, and its documents' requests, final responses and failures.
1229
1293
  Its document is the last its main frame committed from its own navigation on, which a page that sends itself
1230
1294
  elsewhere before it loads replaces. It's ``settled`` once its navigation or its document has failed, its document
1231
- has loaded or, on one of the env's ``site``, answered an error."""
1295
+ has loaded or, on one of the env's ``site``, answered an error. A ``reloading`` one's navigation stayed in its
1296
+ document and was followed by a reload, whose answer names no loader either: its loader is its main frame's first
1297
+ document request or commit after, so a reload that fails before it commits fails the load."""
1232
1298
  session: str
1233
1299
  url: str
1234
1300
  site: Optional[str]
@@ -1242,6 +1308,8 @@ class _StartLoad:
1242
1308
  failures: dict[str, str] = field(default_factory=dict)
1243
1309
  settled: asyncio.Event = field(default_factory=asyncio.Event)
1244
1310
  navigating: Optional[asyncio.Future] = None
1311
+ reloading: bool = False
1312
+ moved: asyncio.Event = field(default_factory=asyncio.Event)
1245
1313
 
1246
1314
  def answered(self, navigating: asyncio.Future) -> None:
1247
1315
  """The browser's answer to its navigation: its loader, or why it couldn't navigate."""
@@ -1255,7 +1323,7 @@ class _StartLoad:
1255
1323
  self.error = str(answer["error"].get("message", answer["error"]))
1256
1324
  else:
1257
1325
  self.error = answer.get("result", {}).get("errorText") or None
1258
- self.loader = answer.get("result", {}).get("loaderId")
1326
+ self.loader = answer.get("result", {}).get("loaderId") or self.loader
1259
1327
  self.check()
1260
1328
 
1261
1329
  def current(self) -> Optional[str]:
@@ -1274,18 +1342,6 @@ class _StartLoad:
1274
1342
  self.settled.set()
1275
1343
 
1276
1344
 
1277
- def _landed_at(landed: asyncio.Future, navigating: asyncio.Future) -> None:
1278
- """``landed`` given the loader a start tab's navigation answered with; cancelled when it failed or named none."""
1279
- if landed.done():
1280
- return
1281
- answer = None if navigating.cancelled() or navigating.exception() is not None else navigating.result()
1282
- loader = ((answer or {}).get("result") or {}).get("loaderId")
1283
- if isinstance(loader, str):
1284
- landed.set_result(loader)
1285
- else:
1286
- landed.cancel()
1287
-
1288
-
1289
1345
  def _types(event: dict) -> bool:
1290
1346
  """Whether a page input event types something."""
1291
1347
  return event.get("method") in TYPING_METHODS and any(field in (event.get("params") or {}) for field in KEY_FIELDS)
@@ -563,12 +563,13 @@ class Causes:
563
563
 
564
564
  async def navigated_within(self, target: str) -> Optional[dict]:
565
565
  """What moved ``target`` within its document, once its navigations in flight have answered: a navigation
566
- answered with no loader, else a reload or move in history, which it uses up."""
566
+ answered with no loader, else a reload or move in history, which it uses up; one asked for after that
567
+ navigation, as a start tab's reload is, is left for the navigation it makes."""
567
568
  if target not in self._same_document and self._navigating.get(target):
568
569
  await asyncio.wait(set(self._navigating[target]), timeout=CAUSE_WAIT_S)
569
- pending = self._next.pop(target, None)
570
570
  if (cause := self._same_document.pop(target, None)) is not None:
571
571
  return cause
572
+ pending = self._next.pop(target, None)
572
573
  if pending is not None and pending[1] >= asyncio.get_running_loop().time():
573
574
  return pending[0]
574
575
  return None
@@ -30,7 +30,7 @@ from agentenv_protocol.website_browser.log import REDACTED, TOOL_CALL_HEADER, Br
30
30
  from agentenv_protocol.computer import Launch, Platform, Ready, app, computer_app, linux # noqa: E402
31
31
  from agentenv_protocol.computer.app import APP_SETTINGS_ENV # noqa: E402
32
32
  from agentenv_protocol.computer.app_runtime import AppReadiness # noqa: E402
33
- from agentenv_protocol.computer.errors import DeviceUnavailable, InvalidArgument # noqa: E402
33
+ from agentenv_protocol.computer.errors import DeviceUnavailable, InvalidArgument, TargetUnavailable # noqa: E402
34
34
  from agentenv_protocol.website_browser import SITE_PROXY_ENV, WebsiteBrowserEnvironment # noqa: E402
35
35
 
36
36
  FORWARDED = {"x-forwarded-host": "computer.test:443", "x-forwarded-proto": "https",
@@ -112,6 +112,39 @@ class ContextPipe(Pipe):
112
112
  return await super().request(method, params, session_id=session_id, answered=answered)
113
113
 
114
114
 
115
+ class PagesPipe(ContextPipe):
116
+ """A ContextPipe on which agentenv's own pages are ``H<n>``, keeping in ``ended``, in order, each page agentenv
117
+ closes and each context an agent disposes."""
118
+
119
+ def __init__(self) -> None:
120
+ super().__init__()
121
+ self.pages, self.ended = 0, []
122
+
123
+ async def call(self, method, params=None, *, session_id=None, timeout_s=None):
124
+ if method == "Target.createTarget":
125
+ self.pages += 1
126
+ return {"targetId": f"H{self.pages}"}
127
+ if method == "Target.attachToTarget":
128
+ return {"sessionId": f"s-{params['targetId']}"}
129
+ if method == "Target.closeTarget":
130
+ self.ended.append(("closed", params["targetId"]))
131
+ return await super().call(method, params, session_id=session_id, timeout_s=timeout_s)
132
+
133
+ async def request(self, method, params=None, *, session_id=None, answered=None):
134
+ if method == "Target.disposeBrowserContext":
135
+ self.ended.append(("disposed", params["browserContextId"]))
136
+ return await super().request(method, params, session_id=session_id, answered=answered)
137
+
138
+
139
+ class DetachPipe(PagesPipe):
140
+ """A PagesPipe that keeps in ``ended`` each session the relay detaches too."""
141
+
142
+ async def call(self, method, params=None, *, session_id=None, timeout_s=None):
143
+ if method == "Target.detachFromTarget":
144
+ self.ended.append(("detached", params["sessionId"]))
145
+ return await super().call(method, params, session_id=session_id, timeout_s=timeout_s)
146
+
147
+
115
148
  class ScopePipe(ContextPipe):
116
149
  """A browser whose default context ``DEF`` has the page ``P0``, and whose task leases ``L1`` and ``L2`` have the
117
150
  pages ``PB`` and ``PS`` and ``L1`` the worker ``WB``: a connection's setDiscoverTargets announces them, getTargets
@@ -398,6 +431,59 @@ async def test_a_context_an_agent_makes_is_its_lease_keeping_downloads_in_its_fo
398
431
  assert [entry["did"] for entry in relay.connections[0]["guarded"]] == ["changed", "refused"]
399
432
 
400
433
 
434
+ @pytest.mark.asyncio
435
+ async def test_an_agents_dispose_waits_for_agentenvs_own_page_in_its_context_which_takes_no_new_one_meanwhile(
436
+ tmp_path):
437
+ pipe = PagesPipe()
438
+ control = BrowserControl(pipe, "agent")
439
+ contexts = Contexts(pipe, control, home=lambda: tmp_path)
440
+ async with _relay(pipe=pipe, contexts=contexts, control=control) as (_, relay, base):
441
+ async with connect(f"{base}/ada") as ada, connect(f"{base}/ada") as again:
442
+ for n in (1, 2):
443
+ await _ask(ada, {"id": n, "method": "Target.createBrowserContext", "params": {}})
444
+ async with control.hidden_page(context="A1"):
445
+ await ada.send(json.dumps({"id": 3, "method": "Target.disposeBrowserContext",
446
+ "params": {"browserContextId": "A1"}}))
447
+ for _ in range(500):
448
+ if "A1" in control._disposing:
449
+ break
450
+ await asyncio.sleep(0.01)
451
+ with pytest.raises(TargetUnavailable, match="the context 'agent-ada-1' is being disposed"):
452
+ async with control.hidden_page(context="A1"):
453
+ pass
454
+ other = await _ask(again, {"id": 1, "method": "Target.disposeBrowserContext",
455
+ "params": {"browserContextId": "A2"}})
456
+ held = list(pipe.ended)
457
+ disposed = json.loads(await asyncio.wait_for(ada.recv(), 5))
458
+
459
+ assert held == [("disposed", "A2")] and "result" in other
460
+ assert pipe.ended == [("disposed", "A2"), ("closed", "H1"), ("disposed", "A1")]
461
+ assert disposed["id"] == 3 and "result" in disposed and list(contexts) == [] and control._disposing == []
462
+
463
+
464
+ @pytest.mark.asyncio
465
+ async def test_a_connection_ending_waits_for_agentenvs_own_page_in_a_context_it_made_to_end_on_detach(tmp_path):
466
+ pipe = DetachPipe()
467
+ control = BrowserControl(pipe, "agent")
468
+ contexts = Contexts(pipe, control, home=lambda: tmp_path)
469
+ async with _relay(pipe=pipe, contexts=contexts, control=control) as (_, relay, base):
470
+ async with control.hidden_page(context="A1"):
471
+ async with connect(f"{base}/ada") as ada:
472
+ await _ask(ada, {"id": 1, "method": "Target.createBrowserContext", "params": {"disposeOnDetach": True}})
473
+ for _ in range(500):
474
+ if "A1" in control._disposing:
475
+ break
476
+ await asyncio.sleep(0.01)
477
+ held = [event for event in pipe.ended if event[0] == "detached"]
478
+ for _ in range(500):
479
+ if any(event[0] == "detached" for event in pipe.ended):
480
+ break
481
+ await asyncio.sleep(0.01)
482
+
483
+ assert held == [] and [event[0] for event in pipe.ended] == ["closed", "detached"]
484
+ assert list(contexts) == [] and control._disposing == []
485
+
486
+
401
487
  @pytest.mark.asyncio
402
488
  async def test_a_scoped_address_sees_its_lease_as_the_default_and_nothing_of_another_context(tmp_path):
403
489
  pipe, contexts = await _scoped(tmp_path)
@@ -58,6 +58,25 @@ class StubDevTools:
58
58
  listener({"method": method, "params": params, **({"sessionId": session} if session else {})})
59
59
 
60
60
 
61
+ class HeldDevTools(StubDevTools):
62
+ """A StubDevTools whose pages of agentenv's own are ``H<n>``, which holds each call of ``held`` until ``go`` is set,
63
+ ``reached`` set as one arrives."""
64
+
65
+ def __init__(self, held, answers=None):
66
+ super().__init__(answers)
67
+ self.held, self.reached, self.go, self.pages = held, asyncio.Event(), asyncio.Event(), 0
68
+
69
+ async def call(self, method, params=None, *, session_id=None, timeout_s=None):
70
+ if method == "Target.createTarget":
71
+ self.pages += 1
72
+ self.calls.append((method, params or {}, session_id))
73
+ return {"targetId": f"H{self.pages}"}
74
+ if method == self.held:
75
+ self.reached.set()
76
+ await self.go.wait()
77
+ return await super().call(method, params, session_id=session_id, timeout_s=timeout_s)
78
+
79
+
61
80
  def _sent(devtools, method):
62
81
  return [params for called, params, _ in devtools.calls if called == method]
63
82
 
@@ -217,6 +236,48 @@ async def test_a_release_closes_its_tabs_as_agentenvs_deletes_its_folder_and_doe
217
236
  assert await control.tab_list() == []
218
237
 
219
238
 
239
+ @pytest.mark.asyncio
240
+ async def test_a_release_waits_for_agentenvs_own_page_in_its_context_which_takes_no_new_one_and_no_other_context_waits(
241
+ browser_home):
242
+ devtools = HeldDevTools("Network.deleteCookies", {
243
+ "Storage.getCookies": {"cookies": [{"name": "sid", "value": "v", "domain": "shop.test", "path": "/",
244
+ "expires": -1, "httpOnly": False, "secure": False}]},
245
+ "Target.attachToTarget": {"sessionId": "s-hidden"},
246
+ "Runtime.evaluate": {"result": {"value": "https://shop.test"}}})
247
+ control = BrowserControl(devtools, "agent")
248
+ contexts = Contexts(devtools, control, home=lambda: browser_home)
249
+ await contexts.lease("buyer")
250
+ await contexts.lease("seller")
251
+
252
+ async with control.hidden_page(context="C2"):
253
+ deleting = asyncio.ensure_future(control.delete_cookies(context="C1"))
254
+ await asyncio.wait_for(devtools.reached.wait(), 5)
255
+ releasing = asyncio.ensure_future(contexts.release("buyer"))
256
+ for _ in range(500):
257
+ if "C1" in control._disposing:
258
+ break
259
+ await asyncio.sleep(0.01)
260
+ with pytest.raises(TargetUnavailable, match="the context 'buyer' is being disposed"):
261
+ await control.clear_local_storage(["https://shop.test"], "C1")
262
+ cleared = await control.clear_local_storage(["https://shop.test"], "C2")
263
+ courier = await asyncio.wait_for(contexts.lease("courier"), 5)
264
+ courier_released = await asyncio.wait_for(contexts.release("courier"), 5)
265
+ held = [sent for sent in _sent(devtools, "Target.disposeBrowserContext") if sent["browserContextId"] == "C1"]
266
+ devtools.go.set()
267
+ deleted, released = await asyncio.wait_for(asyncio.gather(deleting, releasing), 5)
268
+ ended = [(method, params) for method, params, _ in devtools.calls
269
+ if method in ("Target.closeTarget", "Target.disposeBrowserContext")]
270
+
271
+ assert held == [] and cleared == ["https://shop.test"] and (deleted, released) == (1, True)
272
+ assert courier.id == "C3" and courier_released
273
+ assert ended == [("Target.closeTarget", {"targetId": "H3"}),
274
+ ("Target.disposeBrowserContext", {"browserContextId": "C3"}),
275
+ ("Target.closeTarget", {"targetId": "H2"}),
276
+ ("Target.disposeBrowserContext", {"browserContextId": "C1"}),
277
+ ("Target.closeTarget", {"targetId": "H1"})]
278
+ assert [params.get("browserContextId") for params in _sent(devtools, "Target.createTarget")] == ["C2", "C1", "C2"]
279
+
280
+
220
281
  @pytest.mark.asyncio
221
282
  async def test_a_label_released_and_leased_again_at_once_keeps_the_new_leases_folder(browser_home):
222
283
  _, _, contexts = _contexts(browser_home)
@@ -311,7 +372,7 @@ async def test_a_load_waiting_on_an_agents_lease_that_ends_meanwhile_cant_lease_
311
372
  _, _, contexts = _contexts(browser_home)
312
373
  contexts.made_by_agent("ada", "X1")
313
374
 
314
- async with contexts._lock:
375
+ async with contexts._locks["agent-ada-1"]:
315
376
  waiting = asyncio.ensure_future(contexts.lease("agent-ada-1"))
316
377
  await asyncio.sleep(0)
317
378
  contexts.disposed("X1")
@@ -281,6 +281,21 @@ async def test_a_move_within_a_document_is_the_commands_that_asked_for_it_and_us
281
281
  assert await causes.navigated_within("T1") is None
282
282
 
283
283
 
284
+ @pytest.mark.asyncio
285
+ async def test_a_reload_asked_for_once_a_move_within_a_document_answered_is_left_for_the_navigation_it_makes():
286
+ causes = browser_log.Causes()
287
+ moved, reload = {"seq": 3, "via": "agentenv"}, {"seq": 3, "via": "agentenv", "reload": True}
288
+ answer = asyncio.get_running_loop().create_future()
289
+ causes.navigating("T1", answer, moved)
290
+ within = asyncio.ensure_future(causes.navigated_within("T1"))
291
+ await asyncio.sleep(0)
292
+ answer.set_result(None)
293
+ causes.navigates_next("T1", reload)
294
+
295
+ assert await within == moved
296
+ assert await causes.navigated("T1", "L-reload") == reload
297
+
298
+
284
299
  @pytest.mark.asyncio
285
300
  async def test_a_move_back_with_nowhere_to_go_leaves_no_cause_behind(tmp_path):
286
301
  pipe = Pipe()