agentenv-framework-protocol 0.1.527__tar.gz → 0.1.529__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 (182) hide show
  1. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/PKG-INFO +12 -4
  2. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/README.md +11 -3
  3. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/pyproject.toml +1 -1
  4. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/cdp.py +87 -15
  5. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/devtools.py +12 -4
  6. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/environment.py +20 -0
  7. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/log.py +18 -8
  8. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_browser_cdp.py +130 -6
  9. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_browser_log.py +26 -3
  10. agentenv_framework_protocol-0.1.529/tests/test_devtools_pipe.py +33 -0
  11. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_browser.py +1 -1
  12. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/.gitignore +0 -0
  13. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/LICENSE +0 -0
  14. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/NOTICE +0 -0
  15. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/THIRD_PARTY_NOTICES.md +0 -0
  16. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/__init__.py +0 -0
  17. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/advanced_agent.py +0 -0
  18. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/basic_agent.py +0 -0
  19. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/custom_extensions_agent.py +0 -0
  20. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/multimodal_agent.py +0 -0
  21. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/reference_model.py +0 -0
  22. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/streaming_agent.py +0 -0
  23. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/.gitignore +0 -0
  24. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/Dockerfile +0 -0
  25. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/Dockerfile.dockerignore +0 -0
  26. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/README.md +0 -0
  27. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/data/seed.json +0 -0
  28. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/env.toml +0 -0
  29. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/site.py +0 -0
  30. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/index.html +0 -0
  31. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/package-lock.json +0 -0
  32. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/package.json +0 -0
  33. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/src/main.js +0 -0
  34. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/src/style.css +0 -0
  35. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/examples/website/notes/web/vite.config.js +0 -0
  36. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/__init__.py +0 -0
  37. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
  38. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
  39. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
  40. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
  41. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
  42. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
  43. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
  44. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
  45. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
  46. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
  47. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
  48. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/agent_env_environment.py +0 -0
  49. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/client.py +0 -0
  50. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/__init__.py +0 -0
  51. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_declare.py +0 -0
  52. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_desktop.py +0 -0
  53. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_job.py +0 -0
  54. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_linux.py +0 -0
  55. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_load.py +0 -0
  56. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_macos.py +0 -0
  57. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_reaping.py +0 -0
  58. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_session_posix.py +0 -0
  59. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_session_windows.py +0 -0
  60. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_windows.py +0 -0
  61. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_with_fds.py +0 -0
  62. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/_x11.py +0 -0
  63. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/app.py +0 -0
  64. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/app_data.py +0 -0
  65. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/app_runtime.py +0 -0
  66. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/apps.py +0 -0
  67. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/card.py +0 -0
  68. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/checks.py +0 -0
  69. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
  70. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
  71. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
  72. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/client.py +0 -0
  73. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
  74. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
  75. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
  76. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
  77. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/report.py +0 -0
  78. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
  79. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/dataplane.py +0 -0
  80. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/driver.py +0 -0
  81. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/errors.py +0 -0
  82. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/extensions.py +0 -0
  83. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/frames.py +0 -0
  84. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/keys.py +0 -0
  85. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/launch.py +0 -0
  86. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/manifest.py +0 -0
  87. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/operations.py +0 -0
  88. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/platform.py +0 -0
  89. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/prefix.py +0 -0
  90. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/queue.py +0 -0
  91. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/recording.py +0 -0
  92. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/results.py +0 -0
  93. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/run_install_step.py +0 -0
  94. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/runtime.py +0 -0
  95. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/seed.py +0 -0
  96. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/serve.py +0 -0
  97. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/serve_app.py +0 -0
  98. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/served.py +0 -0
  99. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/session.py +0 -0
  100. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/settings.py +0 -0
  101. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/skill.py +0 -0
  102. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/spaces.py +0 -0
  103. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/svc.py +0 -0
  104. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/computer/tools.py +0 -0
  105. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/errors.py +0 -0
  106. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/manifest.py +0 -0
  107. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/preflight.py +0 -0
  108. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/tool_access.py +0 -0
  109. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/tool_client.py +0 -0
  110. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/tool_context.py +0 -0
  111. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/transfers.py +0 -0
  112. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/types.py +0 -0
  113. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/__init__.py +0 -0
  114. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/clock.py +0 -0
  115. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/conformance.py +0 -0
  116. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/environment.py +0 -0
  117. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/errors.py +0 -0
  118. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/readiness.py +0 -0
  119. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/routes.py +0 -0
  120. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website/session.py +0 -0
  121. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/__init__.py +0 -0
  122. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/control.py +0 -0
  123. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/data.py +0 -0
  124. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/src/agentenv_protocol/website_browser/shapes.py +0 -0
  125. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/computer_fake.py +0 -0
  126. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/probe_fake.py +0 -0
  127. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_agent.py +0 -0
  128. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_agent_examples.py +0 -0
  129. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_cdp_config.py +0 -0
  130. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_object_transfers.py +0 -0
  131. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_peer_agents.py +0 -0
  132. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_proxy.py +0 -0
  133. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_staging.py +0 -0
  134. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_a2a_trajectory_log.py +0 -0
  135. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_agent_env_environment.py +0 -0
  136. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_browser_data.py +0 -0
  137. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_browser_state.py +0 -0
  138. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_client.py +0 -0
  139. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_app_data.py +0 -0
  140. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_app_server.py +0 -0
  141. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_conformance.py +0 -0
  142. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_conformance_checks.py +0 -0
  143. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_conformance_page.py +0 -0
  144. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_conformance_recording.py +0 -0
  145. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_dataplane.py +0 -0
  146. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_declare.py +0 -0
  147. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_driver.py +0 -0
  148. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_driver_keys.py +0 -0
  149. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_extensions.py +0 -0
  150. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_frames.py +0 -0
  151. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_macos.py +0 -0
  152. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_page.py +0 -0
  153. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_queue.py +0 -0
  154. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_recording.py +0 -0
  155. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_seed.py +0 -0
  156. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_serve.py +0 -0
  157. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_served.py +0 -0
  158. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_session_windows.py +0 -0
  159. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_spaces.py +0 -0
  160. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_svc_forward.py +0 -0
  161. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_tool_prefix.py +0 -0
  162. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_computer_windows_driver.py +0 -0
  163. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_control_token.py +0 -0
  164. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_data_objects.py +0 -0
  165. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_errors.py +0 -0
  166. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_extension_methods.py +0 -0
  167. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_intake.py +0 -0
  168. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_manifest.py +0 -0
  169. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_preflight.py +0 -0
  170. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_access.py +0 -0
  171. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_annotations.py +0 -0
  172. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_client.py +0 -0
  173. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_context.py +0 -0
  174. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_context_fastmcp.py +0 -0
  175. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_tool_context_injection.py +0 -0
  176. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_api.py +0 -0
  177. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_conformance.py +0 -0
  178. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_environment.py +0 -0
  179. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_live.py +0 -0
  180. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_mcp.py +0 -0
  181. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/tests/test_website_notes_example.py +0 -0
  182. {agentenv_framework_protocol-0.1.527 → agentenv_framework_protocol-0.1.529}/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.527
3
+ Version: 0.1.529
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
@@ -1080,7 +1080,12 @@ are the profile's template. The base class adds:
1080
1080
  that needs the one before takes it first, with `snapshot_env`.
1081
1081
  - **An action** is a CDP command through the relay (`via: "cdp"`, `who` the connection's user, its `connection`
1082
1082
  number, `method`, and the tab its session is on), an op a driver makes for an agent's MCP tool call (`via: "mcp"`,
1083
- `who` the caller's role, `tool`, `call`, `op`), or an acting op agentenv makes itself (`via: "agentenv"`). Each
1083
+ `who` the caller's role, `tool`, `call`, `op`), an agent's MCP tool call a driver serves through a CDP user's
1084
+ connections, such as Playwright MCP's (`via: "mcp"`, `who`, `tool`, `call`, with no `op`, between `calls/begin`
1085
+ and `calls/end`), or an acting op agentenv makes itself (`via: "agentenv"`). A CDP command of a user with such a
1086
+ call open names it, `for` its entry, or `for` a list of entries when several are open; the call's entry takes
1087
+ the tab its commands acted on, and keeps what it typed only once each typing command of its own found no
1088
+ password field focused. Each
1084
1089
  carries `tab`, `url`, `ok` and, failed, `error`, and is marked `acts` or not by its method or op
1085
1090
  (`log.acts`, `ACTING_OPS`): input, navigation, tab commands, `Runtime.evaluate` and `callFunctionOn`, DOM
1086
1091
  writes, faked responses, and viewport and cookie changes act; the rest read. An acting entry keeps its `params`
@@ -1088,14 +1093,17 @@ are the profile's template. The base class adds:
1088
1093
  as its length; cookie and header values; the values of URL query keys that name a credential; a request's body;
1089
1094
  and each string past 2 KB cut, with its length and sha256. A reading entry keeps none.
1090
1095
  - **A tab event** (`opened`, `navigated`, `closed`) says what caused it: `by: "command"` with the `entry`, `via` and
1091
- `who` of the command that asked for it, matched exactly by the target a new tab's command answers with and the
1096
+ `who` of the command that asked for it, and its `for`, matched exactly by the target a new tab's command answers with and the
1092
1097
  loader a navigation's does; `by: "agentenv"`; `exit` or `stop`; or `by: "page"`, with the `after` of the latest
1093
1098
  acting entry on its tab (its opener's, for a popup), for a click that follows a link, a redirect or a page script.
1094
1099
  - A driver passes an agent's tool call to the browser in the `AgentEnv-Tool-Call` header (`tool_call_header`), with
1095
1100
  the caller's `AgentEnv-Role`; the page driver sends it on every call it makes for a tool. `data/get` writes the log
1096
1101
  beside `browser-state.json` as `browser-log.jsonl`, which `data/add` passes over.
1097
1102
  - **`browser/v1`** on its card: `chromium` (its `version`), `clock: "real"` and, alone, `window`; `log {after}`
1098
- (GET), framework-only, its log's lines after `after`; and
1103
+ (GET), framework-only, its log's lines after `after`; `calls/begin {user, acts?, within_s?}`, framework-only,
1104
+ sent with the tool-call header, which begins the entry of an agent's tool call that `user`'s CDP connections
1105
+ serve and answers its `entry`, and `calls/end {entry, ok, error?}`, which ends it, a call not ended within
1106
+ `within_s` (600 s by default) written as never said to have ended; and
1099
1107
  `record` (GET), framework-only, which returns that record with `launches`, the app server's log of each
1100
1108
  launch (with its cause: `boot`, `server_restart`, `launch`, `data/add` or `data/reset`), each stop it made
1101
1109
  and each exit it didn't, with its exit `code` or the `signal` that ended it, since the computer booted.
@@ -1013,7 +1013,12 @@ are the profile's template. The base class adds:
1013
1013
  that needs the one before takes it first, with `snapshot_env`.
1014
1014
  - **An action** is a CDP command through the relay (`via: "cdp"`, `who` the connection's user, its `connection`
1015
1015
  number, `method`, and the tab its session is on), an op a driver makes for an agent's MCP tool call (`via: "mcp"`,
1016
- `who` the caller's role, `tool`, `call`, `op`), or an acting op agentenv makes itself (`via: "agentenv"`). Each
1016
+ `who` the caller's role, `tool`, `call`, `op`), an agent's MCP tool call a driver serves through a CDP user's
1017
+ connections, such as Playwright MCP's (`via: "mcp"`, `who`, `tool`, `call`, with no `op`, between `calls/begin`
1018
+ and `calls/end`), or an acting op agentenv makes itself (`via: "agentenv"`). A CDP command of a user with such a
1019
+ call open names it, `for` its entry, or `for` a list of entries when several are open; the call's entry takes
1020
+ the tab its commands acted on, and keeps what it typed only once each typing command of its own found no
1021
+ password field focused. Each
1017
1022
  carries `tab`, `url`, `ok` and, failed, `error`, and is marked `acts` or not by its method or op
1018
1023
  (`log.acts`, `ACTING_OPS`): input, navigation, tab commands, `Runtime.evaluate` and `callFunctionOn`, DOM
1019
1024
  writes, faked responses, and viewport and cookie changes act; the rest read. An acting entry keeps its `params`
@@ -1021,14 +1026,17 @@ are the profile's template. The base class adds:
1021
1026
  as its length; cookie and header values; the values of URL query keys that name a credential; a request's body;
1022
1027
  and each string past 2 KB cut, with its length and sha256. A reading entry keeps none.
1023
1028
  - **A tab event** (`opened`, `navigated`, `closed`) says what caused it: `by: "command"` with the `entry`, `via` and
1024
- `who` of the command that asked for it, matched exactly by the target a new tab's command answers with and the
1029
+ `who` of the command that asked for it, and its `for`, matched exactly by the target a new tab's command answers with and the
1025
1030
  loader a navigation's does; `by: "agentenv"`; `exit` or `stop`; or `by: "page"`, with the `after` of the latest
1026
1031
  acting entry on its tab (its opener's, for a popup), for a click that follows a link, a redirect or a page script.
1027
1032
  - A driver passes an agent's tool call to the browser in the `AgentEnv-Tool-Call` header (`tool_call_header`), with
1028
1033
  the caller's `AgentEnv-Role`; the page driver sends it on every call it makes for a tool. `data/get` writes the log
1029
1034
  beside `browser-state.json` as `browser-log.jsonl`, which `data/add` passes over.
1030
1035
  - **`browser/v1`** on its card: `chromium` (its `version`), `clock: "real"` and, alone, `window`; `log {after}`
1031
- (GET), framework-only, its log's lines after `after`; and
1036
+ (GET), framework-only, its log's lines after `after`; `calls/begin {user, acts?, within_s?}`, framework-only,
1037
+ sent with the tool-call header, which begins the entry of an agent's tool call that `user`'s CDP connections
1038
+ serve and answers its `entry`, and `calls/end {entry, ok, error?}`, which ends it, a call not ended within
1039
+ `within_s` (600 s by default) written as never said to have ended; and
1032
1040
  `record` (GET), framework-only, which returns that record with `launches`, the app server's log of each
1033
1041
  launch (with its cause: `boot`, `server_restart`, `launch`, `data/add` or `data/reset`), each stop it made
1034
1042
  and each exit it didn't, with its exit `code` or the `signal` that ended it, since the computer booted.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentenv-framework-protocol"
3
- version = "0.1.527"
3
+ version = "0.1.529"
4
4
  description = "Open data-plane protocol and server SDK for agent environments."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -18,7 +18,8 @@ from typing import TYPE_CHECKING, Any, Literal, Optional
18
18
  from starlette.requests import Request
19
19
  from starlette.websockets import WebSocket, WebSocketDisconnect
20
20
 
21
- from .log import ERROR_CHARS, KEY_FIELDS, TYPING_METHODS, BrowserLog, acts, redact_text, redacted_params
21
+ from .log import (ERROR_CHARS, KEY_FIELDS, TYPING_METHODS, BrowserLog, acts, redact_text, redacted_args,
22
+ redacted_params)
22
23
 
23
24
  if TYPE_CHECKING:
24
25
  from .control import BrowserControl
@@ -213,13 +214,35 @@ class _Connection:
213
214
  self.closing = False
214
215
 
215
216
 
217
+ class _Call:
218
+ """An agent's tool call a driver serves through one CDP user's connections, open from its ``calls/begin`` to its
219
+ ``calls/end``: its entry; the tab its commands last acted on, else the one they last read; whether a password field
220
+ had focus for its typing, None until a typing command of its own is checked; and when it's given up on."""
221
+
222
+ def __init__(self, begun: dict, user: str, call: dict) -> None:
223
+ self.begun, self.user, self.tool, self.args = begun, user, call["tool"], call["args"]
224
+ self.tab: Optional[str] = None
225
+ self.acted = False
226
+ self.password: Optional[bool] = None
227
+ self.expiry: Optional[asyncio.TimerHandle] = None
228
+
229
+ def credit(self, target: Optional[str], acting: bool, typed: bool, password: bool, alone: bool) -> None:
230
+ """One of its user's commands credited to it, ``alone`` or with other calls open: the tab it was on, and for
231
+ one that typed, whether a password field had focus there, taken as so when other calls shared it."""
232
+ if target and alone and (acting or not self.acted):
233
+ self.tab, self.acted = target, self.acted or acting
234
+ if typed:
235
+ self.password = True if password or not alone else bool(self.password)
236
+
237
+
216
238
  class Relay:
217
239
  """Each WebSocket connection given its own browser-level session over ``devtools``, its commands sent on it past the
218
240
  guard and the answers and events of its sessions sent back, so several clients share one browser; and a record of
219
241
  who connected when, and what the guard did to their commands. ``dialogs_answered`` says agentenv answers the
220
242
  browser's dialogs itself. With a ``log``, each command is an entry in it, on the tab its session is on, and
221
243
  ``control``, agentenv's own connection, tells its tab's URL, whether a password field has focus there, and what
222
- causes the tab events a command brings."""
244
+ causes the tab events a command brings. An agent's tool call a driver serves through a CDP user's connections,
245
+ such as Playwright MCP's, is an entry too, which that user's commands are credited to while it's open."""
223
246
 
224
247
  def __init__(self, devtools: DevToolsPipe, *, dialogs_answered: bool = False, log: Optional[BrowserLog] = None,
225
248
  control: Optional[BrowserControl] = None) -> None:
@@ -227,8 +250,37 @@ class Relay:
227
250
  self.connections: list[dict] = []
228
251
  self._by_session: dict[str, _Connection] = {}
229
252
  self._open: set[_Connection] = set()
253
+ #: The tool calls open now, by their entry's sequence number.
254
+ self.calls: dict[int, _Call] = {}
230
255
  devtools.listen(self._event)
231
256
 
257
+ def begin_call(self, user: str, who: str, call: dict, *, acts: bool, within_s: float) -> int:
258
+ """``who``'s tool ``call``, which a driver serves through ``user``'s connections, begun as an entry in the log:
259
+ each of ``user``'s commands is credited to it until ``end_call`` ends it, or ``within_s`` passes and it's
260
+ written as never said to have ended. Its entry's sequence number."""
261
+ begun = self.log.begin({"via": "mcp", "who": who, "tool": call["tool"], "call": call["call"], "acts": acts})
262
+ opened = self.calls[begun["seq"]] = _Call(begun, user, call)
263
+ opened.expiry = asyncio.get_running_loop().call_later(
264
+ within_s, self.end_call, begun["seq"], False, f"its driver didn't say it ended within {within_s:g} s")
265
+ return begun["seq"]
266
+
267
+ def end_call(self, seq: int, ok: bool, error: Optional[str] = None) -> bool:
268
+ """The call begun as entry ``seq`` ended: its entry written with whether it worked and why not, the tab its
269
+ commands acted on and that tab's URL, and, acting, its arguments, what it typed kept only once every command of
270
+ its own that typed found no password field focused. False when no such call is open."""
271
+ call = self.calls.pop(seq, None)
272
+ if call is None:
273
+ return False
274
+ call.expiry.cancel()
275
+ fields: dict[str, Any] = {"tab": call.tab, "url": self.control.url_of(call.tab)
276
+ if self.control is not None and call.tab else None, "ok": ok}
277
+ if error:
278
+ fields["error"] = redact_text(error)[:ERROR_CHARS]
279
+ if call.begun["action"]["acts"]:
280
+ fields["args"] = redacted_args(call.tool, call.args, password=call.password is not False)
281
+ self.log.finish(call.begun, **fields)
282
+ return True
283
+
232
284
  async def serve(self, websocket: WebSocket, user: str) -> None:
233
285
  """``websocket``, a client of ``user``'s, relayed over a browser-level session of its own until either ends."""
234
286
  try:
@@ -281,6 +333,13 @@ class Relay:
281
333
  logged = self._begin(connection, session, method, params)
282
334
  answer, guarded = {"error": {"code": SERVER_ERROR, "message": ENDED_UNANSWERED}}, None
283
335
  sending: Optional[asyncio.Future] = None
336
+ replied = False
337
+
338
+ def reply(answer: dict) -> None:
339
+ nonlocal replied
340
+ replied = True
341
+ self._put(connection, _reply(message, answer))
342
+
284
343
  try:
285
344
  async with connection.order:
286
345
  if logged is not None:
@@ -293,7 +352,8 @@ class Relay:
293
352
  elif verdict.action != "send":
294
353
  answer = {"result": {}}
295
354
  else:
296
- sending = asyncio.ensure_future(self.devtools.request(method, verdict.params, session_id=session))
355
+ sending = asyncio.ensure_future(self.devtools.request(method, verdict.params, session_id=session,
356
+ answered=reply))
297
357
  await asyncio.sleep(0)
298
358
  if sending is not None:
299
359
  try:
@@ -303,10 +363,8 @@ class Relay:
303
363
  if verdict is not None and (verdict.action != "send" or verdict.changed):
304
364
  guarded = GUARDED[verdict.action]
305
365
  self._guarded(connection, method, verdict)
306
- reply = {"id": message.get("id"), **{key: answer[key] for key in ("result", "error") if key in answer}}
307
- if message.get("sessionId"):
308
- reply["sessionId"] = message["sessionId"]
309
- self._put(connection, reply)
366
+ if not replied:
367
+ reply(answer)
310
368
  if verdict is not None and verdict.action == "close":
311
369
  self._close(connection, CLOSED, dropping=False)
312
370
  finally:
@@ -317,7 +375,8 @@ class Relay:
317
375
 
318
376
  def _begin(self, connection: _Connection, session: str, method: str, params: dict) -> Optional[_Logged]:
319
377
  """``connection``'s command, begun in the log, if there is one, on the tab ``session`` is on, or for a browser
320
- command the tab it names; what it causes made known to the control."""
378
+ command the tab it names, ``for`` the tool calls of its user's open now; what it causes made known to the
379
+ control."""
321
380
  if self.log is None:
322
381
  return None
323
382
  target = connection.targets.get(session) if session != connection.session else None
@@ -325,9 +384,12 @@ class Relay:
325
384
  target = params["targetId"]
326
385
  acting = acts(method)
327
386
  url = self.control.url_of(target) if self.control is not None and target else None
328
- begun = self.log.begin({"via": "cdp", "who": connection.user, "connection": connection.number,
329
- "method": method, "acts": acting, "tab": target, "url": url})
330
- return _Logged(self, begun, method, params, target, acting)
387
+ crediting = [call for call in self.calls.values() if call.user == connection.user]
388
+ action = {"via": "cdp", "who": connection.user, "connection": connection.number, "method": method,
389
+ "acts": acting, "tab": target, "url": url}
390
+ if crediting:
391
+ action["for"] = crediting[0].begun["seq"] if len(crediting) == 1 else [c.begun["seq"] for c in crediting]
392
+ return _Logged(self, self.log.begin(action), method, params, target, acting, crediting)
331
393
 
332
394
  @staticmethod
333
395
  def _guarded(connection: _Connection, method: str, verdict: Verdict) -> None:
@@ -398,11 +460,12 @@ class _Logged:
398
460
  and its answer."""
399
461
 
400
462
  def __init__(self, relay: Relay, begun: dict, method: str, params: dict, target: Optional[str],
401
- acting: bool) -> None:
402
- self.relay, self.begun, self.method, self.params, self.target, self.acting = \
403
- relay, begun, method, params, target, acting
463
+ acting: bool, calls: list[_Call]) -> None:
464
+ self.relay, self.begun, self.method, self.params, self.target, self.acting, self.calls = \
465
+ relay, begun, method, params, target, acting, calls
404
466
  control = relay.control
405
- self._cause = cause = {"seq": begun["seq"], "via": "cdp", "who": begun["action"]["who"]}
467
+ self._cause = cause = {"seq": begun["seq"], "via": "cdp", "who": begun["action"]["who"],
468
+ **({"for": begun["action"]["for"]} if "for" in begun["action"] else {})}
406
469
  self._landed: Optional[asyncio.Future] = None
407
470
  self._checks_password = self.password = False
408
471
  if control is None or not acting:
@@ -453,9 +516,18 @@ class _Logged:
453
516
  fields["tab"] = self.target = opened
454
517
  if self.target and self.relay.control is not None and self.begun["action"].get("url") is None:
455
518
  fields["url"] = self.relay.control.url_of(self.target)
519
+ for call in self.calls:
520
+ call.credit(self.target, self.acting, self._checks_password, self.password, alone=len(self.calls) == 1)
456
521
  self.relay.log.finish(self.begun, **fields)
457
522
 
458
523
 
524
+ def _reply(message: dict, answer: dict) -> dict:
525
+ """The client's answer to its command ``message``: the browser's ``answer``, or the relay's own, under its id and
526
+ on its session."""
527
+ return {"id": message.get("id"), **{key: answer[key] for key in ("result", "error") if key in answer},
528
+ **({"sessionId": message["sessionId"]} if message.get("sessionId") else {})}
529
+
530
+
459
531
  def _well_formed(message: Any) -> bool:
460
532
  """Whether ``message`` is a command the relay can read: an object with a string ``method``, and object ``params``
461
533
  and a string ``sessionId`` if any."""
@@ -31,6 +31,7 @@ class DevToolsPipe:
31
31
  def __init__(self) -> None:
32
32
  self._ids = itertools.count(1)
33
33
  self._waiting: dict[int, asyncio.Future] = {}
34
+ self._answered: dict[int, Callable[[dict], None]] = {}
34
35
  self._writer: Optional[asyncio.WriteTransport] = None
35
36
  self._reading: Optional[asyncio.Task] = None
36
37
  self._listeners: list[Callable[[dict], None]] = []
@@ -62,18 +63,22 @@ class DevToolsPipe:
62
63
  raise DevToolsError(f"{method}: {answered['error'].get('message', answered['error'])}")
63
64
  return answered.get("result", {})
64
65
 
65
- async def request(self, method: str, params: Optional[dict] = None, *, session_id: Optional[str] = None) -> dict:
66
+ async def request(self, method: str, params: Optional[dict] = None, *, session_id: Optional[str] = None,
67
+ answered: Optional[Callable[[dict], None]] = None) -> dict:
66
68
  """The browser's whole answer to ``method``, its ``result`` or its ``error``, however long it takes: what a
67
- relay passes on as it is."""
68
- return await self._answer(method, params, session_id, None)
69
+ relay passes on as it is. ``answered`` hears it as the pipe reads it, in order with the events before and after
70
+ it, which the caller, resumed only later, may not be."""
71
+ return await self._answer(method, params, session_id, None, answered)
69
72
 
70
73
  async def _answer(self, method: str, params: Optional[dict], session_id: Optional[str],
71
- timeout_s: Optional[float]) -> dict:
74
+ timeout_s: Optional[float], answered: Optional[Callable[[dict], None]] = None) -> dict:
72
75
  if self._writer is None or self._writer.is_closing():
73
76
  raise ConnectionError("no browser is connected over its debugging pipe")
74
77
  message_id = next(self._ids)
75
78
  answer = asyncio.get_running_loop().create_future()
76
79
  self._waiting[message_id] = answer
80
+ if answered is not None:
81
+ self._answered[message_id] = answered
77
82
  message = {"id": message_id, "method": method, "params": params or {},
78
83
  **({"sessionId": session_id} if session_id else {})}
79
84
  self._writer.write(json.dumps(message).encode() + b"\0")
@@ -81,6 +86,7 @@ class DevToolsPipe:
81
86
  return await asyncio.wait_for(answer, timeout_s)
82
87
  finally:
83
88
  self._waiting.pop(message_id, None)
89
+ self._answered.pop(message_id, None)
84
90
 
85
91
  def close(self) -> None:
86
92
  if self._reading is not None:
@@ -100,6 +106,8 @@ class DevToolsPipe:
100
106
  continue
101
107
  answer = self._waiting.get(message.get("id"))
102
108
  if answer is not None and not answer.done():
109
+ if (answered := self._answered.pop(message["id"], None)) is not None:
110
+ _heard(answered, message)
103
111
  answer.set_result(message)
104
112
  except (asyncio.IncompleteReadError, ConnectionError):
105
113
  if self._writer is not None:
@@ -352,6 +352,26 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
352
352
  written.replace(SITES)
353
353
  return {}
354
354
 
355
+ @extension(BROWSER, op="calls/begin")
356
+ async def browser_calls_begin(self, user: str, request: Request, acts: bool = True, within_s: float = 600.0) -> dict:
357
+ """An agent's tool call, from the tool-call header this is sent with, which a driver serves through ``user``'s
358
+ CDP connections, begun as an entry in the log, by the caller's role: ``user``'s commands are credited to it
359
+ until ``calls/end`` ends it, or ``within_s`` passes and it's written as never said to have ended. Its entry's
360
+ sequence number, ``entry``."""
361
+ call = read_tool_call(request.headers.get(TOOL_CALL_HEADER))
362
+ if call is None:
363
+ raise InvalidArgument(f"calls/begin is sent with the tool call it begins, in its {TOOL_CALL_HEADER} header")
364
+ who = normalize_role(request.headers.get(ROLE_HEADER)) or DEFAULT_ROLE
365
+ return {"entry": self.relay.begin_call(user, who, call, acts=acts, within_s=within_s)}
366
+
367
+ @extension(BROWSER, op="calls/end")
368
+ async def browser_calls_end(self, entry: int, ok: bool, error: Optional[str] = None) -> dict:
369
+ """The tool call ``calls/begin`` began as ``entry`` ended, with whether it worked and, if not, why: its entry
370
+ written, with the tab its commands acted on."""
371
+ if not self.relay.end_call(entry, ok, error):
372
+ raise InvalidArgument(f"no tool call is open as entry {entry}")
373
+ return {}
374
+
355
375
  @extension(BROWSER, op="cdp")
356
376
  async def browser_cdp(self, user: str, request: Request, origin: Optional[str] = None) -> dict:
357
377
  """``user``'s CDP address once the browser's ready, the same one each time it's asked for, as the server that
@@ -75,8 +75,9 @@ ACTING_METHODS: dict[str, tuple[str, ...]] = {
75
75
  ACTING_OPS = frozenset({"page/input", "navigate", "history", "tabs/open", "tabs/activate", "tabs/close",
76
76
  "dialog/answer", "files/choose", "cookies/set", "cookies/delete", "local_storage/set",
77
77
  "local_storage/clear", "sites/set"})
78
- #: The ``browser/v1`` ops an agent's calls are never logged for: the log itself, and agentenv's own bookkeeping.
79
- UNLOGGED_OPS = frozenset({"log", "record"})
78
+ #: The ``browser/v1`` ops an agent's calls are never logged for: the log itself, and agentenv's own bookkeeping, a
79
+ #: driver's calls that begin and end a tool call's own entry among them.
80
+ UNLOGGED_OPS = frozenset({"log", "record", "calls/begin", "calls/end"})
80
81
  #: The CDP methods and ops whose text is typed into the page.
81
82
  TYPING_METHODS = frozenset({"Input.insertText", "Input.dispatchKeyEvent", "Input.imeSetComposition"})
82
83
  #: What a key event says of the key it types, all of it dropped when a password field has focus.
@@ -92,8 +93,10 @@ SECRET_PREFIXES = ("x-amz-", "x-goog-", "x-ms-")
92
93
  URL_FIELDS = frozenset({"url", "urls", "href", "referrer", "documentURL"})
93
94
  #: The fields a page's content or a response's body is in, which an entry withholds, keeping their length and sha256.
94
95
  BODY_FIELDS = frozenset({"body", "postData", "html", "rawResponse"})
95
- #: A tool call's arguments that say what is typed, withheld while a password field has focus.
96
- TYPED_ARGS = frozenset({"text", "keys"})
96
+ #: A tool call's arguments that say what is typed, withheld while a password field has focus: text, keys, or a key.
97
+ TYPED_ARGS = frozenset({"text", "keys", "key"})
98
+ #: A tool call's argument that lists form fields, each typed into as its ``value`` says.
99
+ FIELDS_ARG = "fields"
97
100
  _WORDS = re.compile(r"[A-Z]?[a-z0-9]+|[A-Z]+(?![a-z])")
98
101
  #: A URL inside free text, such as an error message.
99
102
  _URL_IN_TEXT = re.compile(r"[A-Za-z][A-Za-z0-9+.-]*://[^\s\"'<>]+")
@@ -240,10 +243,15 @@ def redacted_op(op: str, params: dict, *, password: bool = False) -> dict:
240
243
 
241
244
  def redacted_args(tool: str, args: Mapping[str, Any], *, password: bool = False) -> dict:
242
245
  """An MCP tool call's arguments as its entry keeps them: URLs as ``redact_url`` keeps them, and what it types, its
243
- text or its keys in whatever shape the header carried them, as its length while a password field has focus."""
246
+ text, its keys or its form fields' values, in whatever shape the header carried them, as its length while a
247
+ password field has focus."""
244
248
  kept = _urls_and_bodies(args)
245
249
  if password:
246
250
  kept = {key: {"length": _length(value)} if key in TYPED_ARGS else value for key, value in kept.items()}
251
+ if isinstance(kept.get(FIELDS_ARG), list):
252
+ kept[FIELDS_ARG] = [{**field, "value": {"length": _length(field["value"])}}
253
+ if isinstance(field, Mapping) and "value" in field else field
254
+ for field in kept[FIELDS_ARG]]
247
255
  return cut(kept)
248
256
 
249
257
 
@@ -449,14 +457,16 @@ def _scan(path: Path) -> tuple[int, bool, dict[int, tuple[int, int]], int]:
449
457
 
450
458
 
451
459
  def caused(cause: Optional[dict], log: BrowserLog, tab: Optional[str]) -> dict:
452
- """What a tab event says caused it: the command it was, by its entry, ``via`` and ``who``; agentenv itself; or,
453
- with no ``cause``, the page, after the latest acting entry on ``tab`` if there is one."""
460
+ """What a tab event says caused it: the command it was, by its entry, ``via`` and ``who``, and the tool call it
461
+ served ``for`` when it was credited to one; agentenv itself; or, with no ``cause``, the page, after the latest
462
+ acting entry on ``tab`` if there is one."""
454
463
  if cause is None:
455
464
  after = log.last_acting.get(tab) if tab else None
456
465
  return {"by": "page", **({"after": after} if after else {})}
457
466
  if cause.get("via") == "agentenv":
458
467
  return {"by": "agentenv"}
459
- return {"by": "command", "entry": cause["seq"], "via": cause["via"], "who": cause.get("who")}
468
+ return {"by": "command", "entry": cause["seq"], "via": cause["via"], "who": cause.get("who"),
469
+ **({"for": cause["for"]} if cause.get("for") is not None else {})}
460
470
 
461
471
 
462
472
  def log_time() -> str:
@@ -45,7 +45,8 @@ class Browser(WebsiteBrowserEnvironment):
45
45
 
46
46
  class Pipe:
47
47
  """A browser's pipe: each connection's browser-level session ``b<n>``, an attach on a session making its child
48
- ``<session>-c`` and saying so on that session, ``Boom`` failing, ``Hang`` never answered, anything else echoed;
48
+ ``<session>-c`` and saying so on that session, ``Boom`` failing, ``Hang`` never answered, ``Ordered`` answered and
49
+ then followed at once by an event, as the real pipe reads them when both came in one read, anything else echoed;
49
50
  every request recorded with the last params of each method, and each ``Hang`` given up."""
50
51
 
51
52
  def __init__(self) -> None:
@@ -65,9 +66,14 @@ class Pipe:
65
66
  return {"sessionId": f"b{self.sessions}"}
66
67
  return {}
67
68
 
68
- async def request(self, method, params=None, *, session_id=None):
69
+ async def request(self, method, params=None, *, session_id=None, answered=None):
69
70
  self.sent.append((method, session_id))
70
71
  self.params[method] = params
72
+ if method == "Ordered":
73
+ answer = {"result": {"method": method}}
74
+ answered(answer)
75
+ self.emit({"method": "Page.after", "sessionId": session_id, "params": {}})
76
+ return answer
71
77
  if method == "Target.attachToTarget":
72
78
  child = f"{session_id}-c"
73
79
  self.emit({"method": "Target.attachedToTarget", "sessionId": session_id,
@@ -154,6 +160,16 @@ def test_a_users_token_is_minted_once_kept_by_hash_and_still_known_after_a_resta
154
160
  assert not ada.named and restarted.address(cys) == cy and cy.named
155
161
 
156
162
 
163
+ @pytest.mark.asyncio
164
+ async def test_an_answer_reaches_its_client_before_the_events_the_browser_sent_after_it():
165
+ async with _relay() as (pipe, relay, base):
166
+ async with connect(f"{base}/ada") as ada:
167
+ await ada.send(json.dumps({"id": 1, "method": "Ordered"}))
168
+ first, second = json.loads(await ada.recv()), json.loads(await ada.recv())
169
+
170
+ assert first == {"id": 1, "result": {"method": "Ordered"}} and second == {"method": "Page.after", "params": {}}
171
+
172
+
157
173
  @pytest.mark.asyncio
158
174
  async def test_each_connection_gets_its_own_browser_session_its_own_answers_and_events_and_its_commands_end_with_it():
159
175
  async with _relay() as (pipe, relay, base):
@@ -282,18 +298,19 @@ async def test_a_client_that_falls_too_far_behind_is_closed_and_what_waited_for_
282
298
 
283
299
 
284
300
  class Control:
285
- """agentenv's control as the relay asks it: the URL of tab T1, a password field focused wherever it's asked, and
286
- the causes of tab events; each check made with how many commands ``pipe`` had been sent by then."""
301
+ """agentenv's control as the relay asks it: the URL of tab T1, a password field focused wherever it's asked unless
302
+ ``focused`` says not, and the causes of tab events; each check made with how many commands ``pipe`` had been sent
303
+ by then."""
287
304
 
288
305
  def __init__(self, pipe=None) -> None:
289
- self.causes, self.asked, self.pipe = Causes(), [], pipe
306
+ self.causes, self.asked, self.pipe, self.focused = Causes(), [], pipe, True
290
307
 
291
308
  def url_of(self, target):
292
309
  return "https://a.test/page" if target == "T1" else None
293
310
 
294
311
  async def password_focused(self, target) -> bool:
295
312
  self.asked.append((target, len(self.pipe.sent) if self.pipe is not None else None))
296
- return True
313
+ return self.focused
297
314
 
298
315
 
299
316
  @pytest.mark.asyncio
@@ -332,6 +349,90 @@ async def test_every_relayed_command_is_an_entry_on_its_sessions_tab_an_acting_o
332
349
  assert [target for target, _ in control.asked] == ["T1"]
333
350
 
334
351
 
352
+ async def _attached(socket) -> str:
353
+ return (await _ask(socket, {"id": 0, "method": "Target.attachToTarget",
354
+ "params": {"targetId": "T1", "flatten": True}}))["result"]["sessionId"]
355
+
356
+
357
+ def _call(tool: str, call: str, args: dict) -> dict:
358
+ return {"tool": tool, "call": call, "args": args}
359
+
360
+
361
+ @pytest.mark.asyncio
362
+ async def test_a_users_commands_are_credited_to_its_open_tool_call_or_to_every_one_open_when_calls_overlap(tmp_path):
363
+ log, control = BrowserLog(tmp_path / "browser-chromium.jsonl"), Control()
364
+ async with _relay(log=log, control=control) as (pipe, relay, base):
365
+ async with connect(f"{base}/playwright-mcp") as mcp, connect(f"{base}/ada") as ada:
366
+ child = await _attached(mcp)
367
+ click = relay.begin_call("playwright-mcp", "agent", _call("browser_click", "c1", {"target": "e3"}),
368
+ acts=True, within_s=60)
369
+ await _ask(mcp, {"id": 1, "method": "Input.dispatchMouseEvent", "params": {"type": "mousePressed"},
370
+ "sessionId": child})
371
+ await _ask(ada, {"id": 1, "method": "Browser.getVersion"})
372
+ snapshot = relay.begin_call("playwright-mcp", "agent", _call("browser_snapshot", "c2", {}), acts=False,
373
+ within_s=60)
374
+ await _ask(mcp, {"id": 2, "method": "DOM.getDocument", "sessionId": child})
375
+ ended = relay.end_call(click, True), relay.end_call(snapshot, False, "Playwright MCP ended during it")
376
+ await _ask(mcp, {"id": 3, "method": "DOM.getDocument", "sessionId": child})
377
+ again = relay.end_call(click, True)
378
+ await asyncio.sleep(0.05)
379
+
380
+ mine = {"via": "cdp", "who": "playwright-mcp", "connection": 1, "tab": "T1", "url": "https://a.test/page"}
381
+ assert [line["action"] for line in log.read()["lines"]] == [
382
+ {**mine, "method": "Target.attachToTarget", "acts": False, "ok": True},
383
+ {"via": "mcp", "who": "agent", "tool": "browser_click", "call": "c1", "acts": True, "tab": "T1",
384
+ "url": "https://a.test/page", "ok": True, "args": {"target": "e3"}},
385
+ {**mine, "method": "Input.dispatchMouseEvent", "acts": True, "for": click, "ok": True,
386
+ "params": {"type": "mousePressed"}},
387
+ {"via": "cdp", "who": "ada", "connection": 2, "method": "Browser.getVersion", "acts": False, "tab": None,
388
+ "url": None, "ok": True},
389
+ {"via": "mcp", "who": "agent", "tool": "browser_snapshot", "call": "c2", "acts": False, "tab": None,
390
+ "url": None, "ok": False, "error": "Playwright MCP ended during it"},
391
+ {**mine, "method": "DOM.getDocument", "acts": False, "for": [click, snapshot], "ok": True},
392
+ {**mine, "method": "DOM.getDocument", "acts": False, "ok": True},
393
+ ]
394
+ assert ended == (True, True) and again is False and not relay.calls
395
+
396
+
397
+ @pytest.mark.asyncio
398
+ async def test_a_tool_calls_typed_text_is_kept_only_once_its_own_typing_found_no_password_field(tmp_path):
399
+ log, control = BrowserLog(tmp_path / "browser-chromium.jsonl"), Control()
400
+ async with _relay(log=log, control=control) as (pipe, relay, base):
401
+ async with connect(f"{base}/playwright-mcp") as mcp:
402
+ child = await _attached(mcp)
403
+ for n, (focused, types) in enumerate([(False, True), (True, True), (False, False)], start=1):
404
+ control.focused = focused
405
+ entry = relay.begin_call("playwright-mcp", "agent",
406
+ _call("browser_type", f"c{n}", {"target": "e3", "text": "hunter2"}),
407
+ acts=True, within_s=60)
408
+ if types:
409
+ await _ask(mcp, {"id": n, "method": "Input.insertText", "params": {"text": "hunter2"},
410
+ "sessionId": child})
411
+ relay.end_call(entry, True)
412
+ await asyncio.sleep(0.05)
413
+
414
+ typed = {line["action"]["call"]: line["action"]["args"]["text"] for line in log.read()["lines"]
415
+ if line["action"]["via"] == "mcp"}
416
+ assert typed == {"c1": "hunter2", "c2": {"length": 7}, "c3": {"length": 7}}
417
+
418
+
419
+ @pytest.mark.asyncio
420
+ async def test_a_tool_call_never_said_to_end_is_written_so_once_its_bound_passes_and_is_credited_no_more(tmp_path):
421
+ log = BrowserLog(tmp_path / "browser-chromium.jsonl")
422
+ async with _relay(log=log) as (pipe, relay, base):
423
+ async with connect(f"{base}/playwright-mcp") as mcp:
424
+ entry = relay.begin_call("playwright-mcp", "agent", _call("browser_click", "c1", {}), acts=True,
425
+ within_s=0.05)
426
+ await asyncio.sleep(0.1)
427
+ await _ask(mcp, {"id": 1, "method": "Browser.getVersion"})
428
+ ended = relay.end_call(entry, True)
429
+ await asyncio.sleep(0.05)
430
+
431
+ call, command = [line["action"] for line in log.read()["lines"]]
432
+ assert (call["ok"], call["error"]) == (False, "its driver didn't say it ended within 0.05 s")
433
+ assert "for" not in command and ended is False
434
+
435
+
335
436
  @pytest.mark.asyncio
336
437
  async def test_a_command_is_checked_for_a_password_before_it_is_sent_and_logged_though_its_client_leaves(tmp_path):
337
438
  log = BrowserLog(tmp_path / "browser-chromium.jsonl")
@@ -417,6 +518,29 @@ async def test_an_op_for_an_agents_tool_call_and_agentenvs_own_acting_ops_are_en
417
518
  assert read["last"] == 4 and not read["more"]
418
519
 
419
520
 
521
+ @pytest.mark.asyncio
522
+ async def test_calls_begin_and_end_write_a_tool_calls_entry_from_its_header_and_are_no_entries_themselves(
523
+ monkeypatch, tmp_path):
524
+ (tmp_path / "logs").mkdir()
525
+ browser = _browser(monkeypatch, tmp_path)
526
+ asgi = browser.served_asgi(browser.create_app().streamable_http_app())
527
+ url = "https://a.test/?token=t"
528
+ called = {TOOL_CALL_HEADER: tool_call_header("browser_navigate", "c1", {"url": url}), "AgentEnv-Role": "ada"}
529
+
530
+ async with httpx.AsyncClient(transport=httpx.ASGITransport(app=asgi), base_url="http://app") as http:
531
+ begun = await http.post("/agentenv/ext/browser/calls/begin", json={"user": "playwright-mcp"}, headers=called)
532
+ ended = await http.post("/agentenv/ext/browser/calls/end", json={"entry": begun.json()["entry"], "ok": True})
533
+ headerless = await http.post("/agentenv/ext/browser/calls/begin", json={"user": "playwright-mcp"})
534
+ unknown = await http.post("/agentenv/ext/browser/calls/end", json={"entry": 99, "ok": True})
535
+ read = (await http.get("/agentenv/ext/browser/log", params={"after": 0})).json()
536
+
537
+ assert [line["action"] for line in read["lines"]] == [
538
+ {"via": "mcp", "who": "ada", "tool": "browser_navigate", "call": "c1", "acts": True, "tab": None, "url": None,
539
+ "ok": True, "args": {"url": f"https://a.test/?token={REDACTED}"}}]
540
+ assert ended.status_code == 200 and headerless.status_code == 400 and unknown.status_code == 400
541
+ assert "AgentEnv-Tool-Call" in headerless.json()["error"]["message"]
542
+
543
+
420
544
  @pytest.mark.asyncio
421
545
  async def test_a_commands_wait_for_its_password_check_lets_none_after_it_be_sent_first(tmp_path):
422
546
  log = BrowserLog(tmp_path / "browser-chromium.jsonl")