agentenv-framework-protocol 0.1.551__tar.gz → 0.1.554__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.551 → agentenv_framework_protocol-0.1.554}/PKG-INFO +1 -1
  2. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/pyproject.toml +1 -1
  3. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/cdp.py +17 -7
  4. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/contexts.py +11 -7
  5. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/control.py +35 -10
  6. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_cdp.py +87 -1
  7. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_contexts.py +62 -1
  8. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/.gitignore +0 -0
  9. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/LICENSE +0 -0
  10. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/NOTICE +0 -0
  11. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/README.md +0 -0
  12. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/THIRD_PARTY_NOTICES.md +0 -0
  13. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/__init__.py +0 -0
  14. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/advanced_agent.py +0 -0
  15. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/basic_agent.py +0 -0
  16. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/custom_extensions_agent.py +0 -0
  17. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/multimodal_agent.py +0 -0
  18. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/reference_model.py +0 -0
  19. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/streaming_agent.py +0 -0
  20. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/.gitignore +0 -0
  21. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/Dockerfile +0 -0
  22. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/Dockerfile.dockerignore +0 -0
  23. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/README.md +0 -0
  24. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/data/seed.json +0 -0
  25. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/env.toml +0 -0
  26. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/site.py +0 -0
  27. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/index.html +0 -0
  28. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/package-lock.json +0 -0
  29. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/package.json +0 -0
  30. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/src/main.js +0 -0
  31. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/src/style.css +0 -0
  32. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/examples/website/notes/web/vite.config.js +0 -0
  33. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/__init__.py +0 -0
  34. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
  35. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
  36. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  37. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
  38. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
  39. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  40. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
  41. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  42. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  43. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  44. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
  45. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/agent_env_environment.py +0 -0
  46. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/client.py +0 -0
  47. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/__init__.py +0 -0
  48. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_declare.py +0 -0
  49. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_desktop.py +0 -0
  50. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_job.py +0 -0
  51. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_linux.py +0 -0
  52. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_load.py +0 -0
  53. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_macos.py +0 -0
  54. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_reaping.py +0 -0
  55. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  56. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  57. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_windows.py +0 -0
  58. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  59. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/_x11.py +0 -0
  60. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/app.py +0 -0
  61. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/app_data.py +0 -0
  62. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  63. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/apps.py +0 -0
  64. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/card.py +0 -0
  65. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/checks.py +0 -0
  66. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/clock.py +0 -0
  67. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  68. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  69. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  70. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  71. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  72. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  73. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  74. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  75. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  76. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  77. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/dataplane.py +0 -0
  78. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/driver.py +0 -0
  79. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/errors.py +0 -0
  80. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/extensions.py +0 -0
  81. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/frames.py +0 -0
  82. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/keys.py +0 -0
  83. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/launch.py +0 -0
  84. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/manifest.py +0 -0
  85. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/operations.py +0 -0
  86. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/platform.py +0 -0
  87. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/prefix.py +0 -0
  88. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/queue.py +0 -0
  89. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/recording.py +0 -0
  90. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/results.py +0 -0
  91. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  92. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/runtime.py +0 -0
  93. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/seed.py +0 -0
  94. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/serve.py +0 -0
  95. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/serve_app.py +0 -0
  96. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/served.py +0 -0
  97. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/session.py +0 -0
  98. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/settings.py +0 -0
  99. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/skill.py +0 -0
  100. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/spaces.py +0 -0
  101. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/svc.py +0 -0
  102. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/computer/tools.py +0 -0
  103. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/errors.py +0 -0
  104. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/manifest.py +0 -0
  105. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/passthrough.py +0 -0
  106. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/preflight.py +0 -0
  107. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/tool_access.py +0 -0
  108. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/tool_client.py +0 -0
  109. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/tool_context.py +0 -0
  110. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/transfers.py +0 -0
  111. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/types.py +0 -0
  112. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/__init__.py +0 -0
  113. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/clock.py +0 -0
  114. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/conformance.py +0 -0
  115. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/environment.py +0 -0
  116. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/errors.py +0 -0
  117. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/forwarding.py +0 -0
  118. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/readiness.py +0 -0
  119. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/routes.py +0 -0
  120. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website/session.py +0 -0
  121. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  122. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/data.py +0 -0
  123. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/devtools.py +0 -0
  124. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/environment.py +0 -0
  125. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/log.py +0 -0
  126. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/network.py +0 -0
  127. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/recording.py +0 -0
  128. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/scope.py +0 -0
  129. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  130. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/src/agentenv_protocol/website_browser/stream.py +0 -0
  131. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/computer_fake.py +0 -0
  132. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/probe_fake.py +0 -0
  133. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_agent.py +0 -0
  134. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_agent_examples.py +0 -0
  135. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_cdp_config.py +0 -0
  136. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_object_transfers.py +0 -0
  137. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_peer_agents.py +0 -0
  138. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_proxy.py +0 -0
  139. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_staging.py +0 -0
  140. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_a2a_trajectory_log.py +0 -0
  141. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_agent_env_environment.py +0 -0
  142. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_data.py +0 -0
  143. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_log.py +0 -0
  144. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_network.py +0 -0
  145. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_recording.py +0 -0
  146. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_browser_state.py +0 -0
  147. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_client.py +0 -0
  148. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_app_data.py +0 -0
  149. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_app_server.py +0 -0
  150. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_clock.py +0 -0
  151. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_conformance.py +0 -0
  152. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_conformance_attempts.py +0 -0
  153. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_conformance_checks.py +0 -0
  154. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_conformance_page.py +0 -0
  155. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_conformance_recording.py +0 -0
  156. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_dataplane.py +0 -0
  157. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_declare.py +0 -0
  158. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_driver.py +0 -0
  159. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_driver_keys.py +0 -0
  160. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_extensions.py +0 -0
  161. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_frames.py +0 -0
  162. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_macos.py +0 -0
  163. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_page.py +0 -0
  164. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_queue.py +0 -0
  165. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_recording.py +0 -0
  166. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_seed.py +0 -0
  167. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_serve.py +0 -0
  168. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_served.py +0 -0
  169. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_session_windows.py +0 -0
  170. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_spaces.py +0 -0
  171. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_svc_forward.py +0 -0
  172. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_tool_prefix.py +0 -0
  173. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_computer_windows_driver.py +0 -0
  174. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_control_token.py +0 -0
  175. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_data_objects.py +0 -0
  176. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_devtools_pipe.py +0 -0
  177. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_errors.py +0 -0
  178. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_extension_methods.py +0 -0
  179. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_intake.py +0 -0
  180. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_manifest.py +0 -0
  181. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_preflight.py +0 -0
  182. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_access.py +0 -0
  183. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_annotations.py +0 -0
  184. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_client.py +0 -0
  185. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_context.py +0 -0
  186. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_context_fastmcp.py +0 -0
  187. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_tool_context_injection.py +0 -0
  188. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_api.py +0 -0
  189. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_browser.py +0 -0
  190. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_conformance.py +0 -0
  191. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_environment.py +0 -0
  192. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_forwarding.py +0 -0
  193. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_live.py +0 -0
  194. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_mcp.py +0 -0
  195. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/tests/test_website_notes_example.py +0 -0
  196. {agentenv_framework_protocol-0.1.551 → agentenv_framework_protocol-0.1.554}/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.551
3
+ Version: 0.1.554
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.551"
3
+ version = "0.1.554"
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)
@@ -110,6 +110,10 @@ class BrowserControl:
110
110
  self.dialog_log: list[dict] = []
111
111
  self._sessions: dict[str, str] = {}
112
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] = []
113
117
  self._closing: set[str] = set()
114
118
  self._open_dialogs: dict[str, dict] = {}
115
119
  self._answering: set[str] = set()
@@ -583,17 +587,38 @@ class BrowserControl:
583
587
  @contextlib.asynccontextmanager
584
588
  async def hidden_page(self, url: str = "about:blank", context: Optional[str] = None) -> AsyncIterator[str]:
585
589
  """A page of agentenv's own for reading state, in the context ``context``, else the default one, in no window
586
- and never in the record; its session's id. It's closed after."""
587
- target = (await self.devtools.call("Target.createTarget", {
588
- "url": url, "hidden": True, "background": True,
589
- **({"browserContextId": context} if context else {})}))["targetId"]
590
- self._hidden.add(target)
591
- 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
592
596
  try:
593
- 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})
607
+ finally:
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
594
620
  finally:
595
- with contextlib.suppress(ConnectionError, DevToolsError):
596
- await self.devtools.call("Target.closeTarget", {"targetId": target})
621
+ self._disposing.remove(context)
597
622
 
598
623
  async def active_tab(self, context: Optional[str] = None) -> Optional[str]:
599
624
  """The active tab of the context ``context``, else of the default one, as ``page_tab`` picks among its tabs."""
@@ -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")