agentenv-framework-protocol 0.1.531__tar.gz → 0.1.532__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.
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/PKG-INFO +12 -1
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/README.md +11 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/__init__.py +5 -2
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/control.py +74 -1
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/environment.py +24 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/log.py +13 -1
- agentenv_framework_protocol-0.1.532/src/agentenv_protocol/website_browser/recording.py +263 -0
- agentenv_framework_protocol-0.1.532/tests/test_browser_recording.py +284 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/recording.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/cdp.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_browser_log.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.531 → agentenv_framework_protocol-0.1.532}/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.
|
|
3
|
+
Version: 0.1.532
|
|
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
|
|
@@ -1195,6 +1195,17 @@ are the profile's template. The base class adds:
|
|
|
1195
1195
|
The server keeps each token in memory and only its SHA-256, with its user and base address, in
|
|
1196
1196
|
`.agentenv/cdp-tokens.json`, which code in the computer's session can read but not use; an address
|
|
1197
1197
|
outlives a relaunch of the browser and of the server, and the computer's reset ends it.
|
|
1198
|
+
- **`browser-recording/v1`** on its card, framework-only, with `max_duration_s`, `max_frames` and `frames`:
|
|
1199
|
+
`start {request_id, upload, frames?}` records under the write namespace grant `upload`, a start again with the
|
|
1200
|
+
same `request_id` answering the recording it began; `end {recording_id, upload?, reason?}` ends it, under a fresh
|
|
1201
|
+
grant when one is given, and answers its manifest; `end_all {reason?}` ends every open one. With `frames`, a frame
|
|
1202
|
+
is a JPEG of the tab an agent last acted in, else of the active tab: one at the start, one after each burst of an
|
|
1203
|
+
agent's acting entries (CDP commands and MCP calls, not agentenv's own) has gone quiet for 0.5 s and its tab's page
|
|
1204
|
+
has loaded (up to 5 s), and one at the end, each uploaded as it's taken under `<recording_id>/frames/` and keyed in
|
|
1205
|
+
the manifest to the entries it follows (`after`); a frame it couldn't take is in the manifest with its `error`. At
|
|
1206
|
+
the end it uploads the log's lines since its start, actions and tab events, as `log.jsonl`, and `manifest.json`
|
|
1207
|
+
(`BrowserRecordingManifest`). `start_browser_recording` and `end_browser_recording` run it, registering the frames,
|
|
1208
|
+
log and manifest as one file artifact universe, and the end fails the run when its log or a frame is missing.
|
|
1198
1209
|
- **Its CDP relay**, at those addresses: `json/version` and `json/list` (also with a trailing slash,
|
|
1199
1210
|
and `json`) answered from the browser, since a browser on a pipe has none, with its WebSocket at the
|
|
1200
1211
|
address the client reached it at; and `devtools/browser`, where each WebSocket connection gets a
|
|
@@ -1128,6 +1128,17 @@ are the profile's template. The base class adds:
|
|
|
1128
1128
|
The server keeps each token in memory and only its SHA-256, with its user and base address, in
|
|
1129
1129
|
`.agentenv/cdp-tokens.json`, which code in the computer's session can read but not use; an address
|
|
1130
1130
|
outlives a relaunch of the browser and of the server, and the computer's reset ends it.
|
|
1131
|
+
- **`browser-recording/v1`** on its card, framework-only, with `max_duration_s`, `max_frames` and `frames`:
|
|
1132
|
+
`start {request_id, upload, frames?}` records under the write namespace grant `upload`, a start again with the
|
|
1133
|
+
same `request_id` answering the recording it began; `end {recording_id, upload?, reason?}` ends it, under a fresh
|
|
1134
|
+
grant when one is given, and answers its manifest; `end_all {reason?}` ends every open one. With `frames`, a frame
|
|
1135
|
+
is a JPEG of the tab an agent last acted in, else of the active tab: one at the start, one after each burst of an
|
|
1136
|
+
agent's acting entries (CDP commands and MCP calls, not agentenv's own) has gone quiet for 0.5 s and its tab's page
|
|
1137
|
+
has loaded (up to 5 s), and one at the end, each uploaded as it's taken under `<recording_id>/frames/` and keyed in
|
|
1138
|
+
the manifest to the entries it follows (`after`); a frame it couldn't take is in the manifest with its `error`. At
|
|
1139
|
+
the end it uploads the log's lines since its start, actions and tab events, as `log.jsonl`, and `manifest.json`
|
|
1140
|
+
(`BrowserRecordingManifest`). `start_browser_recording` and `end_browser_recording` run it, registering the frames,
|
|
1141
|
+
log and manifest as one file artifact universe, and the end fails the run when its log or a frame is missing.
|
|
1131
1142
|
- **Its CDP relay**, at those addresses: `json/version` and `json/list` (also with a trailing slash,
|
|
1132
1143
|
and `json`) answered from the browser, since a browser on a pipe has none, with its WebSocket at the
|
|
1133
1144
|
address the client reached it at; and `devtools/browser`, where each WebSocket connection gets a
|
|
@@ -12,14 +12,17 @@ from .devtools import MAX_MESSAGE_BYTES, PIPE_IN, PIPE_OUT, DevToolsError, DevTo
|
|
|
12
12
|
from .environment import (ALONE_BYPASS, BLOCK, BROWSER, COMPUTER_BYPASS, OWNED_FLAGS, POLICIES, READY_POLL_S,
|
|
13
13
|
SHM_MIN_BYTES, SITE_PROXY_ENV, SITES, SKILL, BrowserSettings, WebsiteBrowserEnvironment,
|
|
14
14
|
Window, start_tab_why)
|
|
15
|
+
from .recording import BROWSER_RECORDING, BrowserRecordingManifest, BrowserRecordings, RecordedFrame
|
|
15
16
|
from .shapes import (BrowserRecord, ClosedTab, Cookie, CookieToSet, Dialog, Download, LaunchEntry, OpenTab,
|
|
16
17
|
OriginStorage, PartitionKey, SiteNames, StartTab, StartTabsLaunch, StorageItem, origin_of)
|
|
17
18
|
|
|
18
|
-
__all__ = ["ACTIVE_CHECK_TIMEOUT_S", "AGENT", "AGENTENV", "ALONE_BYPASS", "BLOCK", "BROWSER", "
|
|
19
|
+
__all__ = ["ACTIVE_CHECK_TIMEOUT_S", "AGENT", "AGENTENV", "ALONE_BYPASS", "BLOCK", "BROWSER", "BROWSER_RECORDING",
|
|
20
|
+
"CAPTURE_TIMEOUT_S",
|
|
19
21
|
"COMPUTER_BYPASS", "DOWNLOADS", "EXIT", "FAILED", "HASH_CHUNK_BYTES", "LIVE_START_TAB_TIMEOUT_S", "LOADED",
|
|
20
22
|
"MAX_MESSAGE_BYTES", "OWNED_FLAGS", "PAGE_INPUT", "PAGES", "PIN_TIMEOUT_S", "PIPE_IN", "PIPE_OUT",
|
|
21
23
|
"POLICIES", "READY_POLL_S", "SHM_MIN_BYTES", "SITE_PROXY_ENV", "SITES", "SKILL", "STOP", "TIMED_OUT",
|
|
22
24
|
"UNKNOWN", "UNNAVIGATED_CAPTURE_TIMEOUT_S", "UPLOADS", "BrowserControl", "BrowserSettings", "DevToolsError",
|
|
23
25
|
"DevToolsPipe", "WebsiteBrowserEnvironment", "Window", "BrowserRecord", "ClosedTab", "Cookie", "CookieToSet",
|
|
24
26
|
"Dialog", "Download", "LaunchEntry", "OpenTab", "OriginStorage", "PartitionKey", "SiteNames", "StartTab",
|
|
25
|
-
"StartTabsLaunch", "StorageItem", "origin_of", "start_tab_why"
|
|
27
|
+
"StartTabsLaunch", "StorageItem", "origin_of", "start_tab_why", "BrowserRecordingManifest", "BrowserRecordings",
|
|
28
|
+
"RecordedFrame"]
|
|
@@ -44,6 +44,13 @@ PAGES = [{"type": "page"}]
|
|
|
44
44
|
#: The CDP input a computer's page driver may send to the active tab, and how long its screenshot may take.
|
|
45
45
|
PAGE_INPUT = frozenset({"Input.dispatchMouseEvent", "Input.dispatchKeyEvent", "Input.insertText"})
|
|
46
46
|
CAPTURE_TIMEOUT_S, UNNAVIGATED_CAPTURE_TIMEOUT_S = 3.0, 1.0
|
|
47
|
+
#: A frame's quality as a JPEG, which is a fifth to a tenth of the PNG's size.
|
|
48
|
+
FRAME_QUALITY = 80
|
|
49
|
+
#: How long a frame's capture may go unanswered before a second capture is sent: Chrome answers a capture of a tab
|
|
50
|
+
#: behind the active one only once another capture of it arrives, and then answers both.
|
|
51
|
+
NUDGE_S = 0.5
|
|
52
|
+
#: How often a wait for a tab to load looks again.
|
|
53
|
+
LOAD_POLL_S = 0.1
|
|
47
54
|
#: Where an agent's files to upload are, and where downloads land, under the session user's home.
|
|
48
55
|
UPLOADS = "Uploads"
|
|
49
56
|
DOWNLOADS = "Downloads"
|
|
@@ -97,11 +104,15 @@ class BrowserControl:
|
|
|
97
104
|
#: Each tab's latest capture, which shows while a dialog keeps its page from painting; and, by session, what
|
|
98
105
|
#: input sent there waits on to learn a dialog opened.
|
|
99
106
|
self._shots: dict[str, str] = {}
|
|
107
|
+
#: Each tab's latest frame, the image and its format, which a frame shows again while a dialog keeps it from
|
|
108
|
+
#: painting.
|
|
109
|
+
self._frames: dict[str, tuple[str, str]] = {}
|
|
100
110
|
self._dialog_opened: dict[str, asyncio.Event] = {}
|
|
101
111
|
self._pinned: dict[str, asyncio.Event] = {}
|
|
102
112
|
self._tasks: set[asyncio.Future] = set()
|
|
103
|
-
#: Each start tab loading, by its session.
|
|
113
|
+
#: Each start tab loading, by its session; and each tab whose page has committed and not yet loaded.
|
|
104
114
|
self._loading: dict[str, _StartLoad] = {}
|
|
115
|
+
self._page_loading: set[str] = set()
|
|
105
116
|
#: Every http and https origin a page or frame it follows loaded since this server started, and the sessions
|
|
106
117
|
#: of agentenv's own pages whose requests it answers itself.
|
|
107
118
|
self.origins: set[str] = set()
|
|
@@ -613,6 +624,63 @@ class BrowserControl:
|
|
|
613
624
|
await self._refresh(target)
|
|
614
625
|
return {**({"png": png} if png is not None else {"blank": True}), "page": self._state_of(target)}
|
|
615
626
|
|
|
627
|
+
async def frame(self, target: Optional[str], load_wait_s: float) -> tuple[str, str, Optional[str], Optional[str]]:
|
|
628
|
+
"""A frame of the tab ``target``, else, for none or one that's gone, of the active tab: once its page has loaded,
|
|
629
|
+
waiting up to ``load_wait_s``, a JPEG of it as it shows, or, with a dialog keeping it from painting, the frame it
|
|
630
|
+
last took, else its last capture, a PNG; a tab that closes while its page loads is the active tab's. The image
|
|
631
|
+
base64, its format and the tab and its URL; DeviceUnavailable with no tab open, or for one that paints nothing
|
|
632
|
+
in time."""
|
|
633
|
+
session = next((s for s, t in self._sessions.items() if t == target), None) if target else None
|
|
634
|
+
if session is None:
|
|
635
|
+
session = await self.active_session()
|
|
636
|
+
target = self._sessions[session]
|
|
637
|
+
deadline = asyncio.get_running_loop().time() + load_wait_s
|
|
638
|
+
while target in self._page_loading and asyncio.get_running_loop().time() < deadline:
|
|
639
|
+
await asyncio.sleep(LOAD_POLL_S)
|
|
640
|
+
if session not in self._sessions:
|
|
641
|
+
session = await self.active_session()
|
|
642
|
+
target = self._sessions[session]
|
|
643
|
+
if session in self._open_dialogs:
|
|
644
|
+
if (earlier := self._frames.get(target)) is None and (shot := self._shots.get(target)) is not None:
|
|
645
|
+
earlier = shot, "png"
|
|
646
|
+
if earlier is None:
|
|
647
|
+
raise DeviceUnavailable("a dialog keeps the tab from painting and it had no capture before it")
|
|
648
|
+
return *earlier, target, self.url_of(target)
|
|
649
|
+
try:
|
|
650
|
+
shot = await self._nudged_capture(session)
|
|
651
|
+
except asyncio.TimeoutError:
|
|
652
|
+
raise DeviceUnavailable(f"the tab painted nothing within {CAPTURE_TIMEOUT_S:g} s") from None
|
|
653
|
+
except (ConnectionError, DevToolsError) as e:
|
|
654
|
+
raise DeviceUnavailable(f"the tab couldn't be captured: {e}") from None
|
|
655
|
+
self._frames[target] = shot["data"], "jpg"
|
|
656
|
+
return shot["data"], "jpg", target, self.url_of(target)
|
|
657
|
+
|
|
658
|
+
async def _nudged_capture(self, session: str) -> dict:
|
|
659
|
+
"""The tab's JPEG from the first of its captures to answer: a second follows one unanswered after ``NUDGE_S``,
|
|
660
|
+
since a tab behind the active one answers only then, all within ``CAPTURE_TIMEOUT_S``."""
|
|
661
|
+
loop = asyncio.get_running_loop()
|
|
662
|
+
deadline = loop.time() + CAPTURE_TIMEOUT_S
|
|
663
|
+
|
|
664
|
+
def capture() -> asyncio.Future:
|
|
665
|
+
return asyncio.ensure_future(self.devtools.call("Page.captureScreenshot", {
|
|
666
|
+
"format": "jpeg", "quality": FRAME_QUALITY, "optimizeForSpeed": True}, session_id=session,
|
|
667
|
+
timeout_s=max(0.0, deadline - loop.time())))
|
|
668
|
+
|
|
669
|
+
captures = {capture()}
|
|
670
|
+
try:
|
|
671
|
+
done, _ = await asyncio.wait(captures, timeout=NUDGE_S)
|
|
672
|
+
if not done:
|
|
673
|
+
captures.add(capture())
|
|
674
|
+
while True:
|
|
675
|
+
done, captures = await asyncio.wait(captures, return_when=asyncio.FIRST_COMPLETED)
|
|
676
|
+
if answers := [c.result() for c in done if c.exception() is None]:
|
|
677
|
+
return answers[0]
|
|
678
|
+
if not captures:
|
|
679
|
+
raise next(iter(done)).exception()
|
|
680
|
+
finally:
|
|
681
|
+
for pending in captures:
|
|
682
|
+
pending.cancel()
|
|
683
|
+
|
|
616
684
|
async def _capture(self, session: str) -> Optional[str]:
|
|
617
685
|
"""The tab's page as it shows now; with a dialog open on it, which keeps it from painting, the last it took."""
|
|
618
686
|
target = self._sessions[session]
|
|
@@ -727,6 +795,8 @@ class BrowserControl:
|
|
|
727
795
|
if session in self._sessions:
|
|
728
796
|
self._saw(params.get("frame", {}).get("url", ""))
|
|
729
797
|
frame = params.get("frame", {})
|
|
798
|
+
if not frame.get("parentId") and (target := self._sessions.get(session)) is not None:
|
|
799
|
+
self._page_loading.add(target)
|
|
730
800
|
if self.log is not None and not frame.get("parentId") and (target := self._sessions.get(session)) in self.tabs:
|
|
731
801
|
self._spawn(self._log_navigated(self.log.reserve(), log_time(), target, frame.get("url", ""),
|
|
732
802
|
frame.get("loaderId")))
|
|
@@ -807,13 +877,16 @@ class BrowserControl:
|
|
|
807
877
|
def _on_Target_detachedFromTarget(self, params: dict, session: Optional[str]) -> None:
|
|
808
878
|
if (target := self._sessions.pop(params["sessionId"], None)) is not None:
|
|
809
879
|
self._shots.pop(target, None)
|
|
880
|
+
self._frames.pop(target, None)
|
|
810
881
|
self._pinned.pop(target, None)
|
|
882
|
+
self._page_loading.discard(target)
|
|
811
883
|
self._choosers.pop(params["sessionId"], None)
|
|
812
884
|
self._dialog_opened.pop(params["sessionId"], None)
|
|
813
885
|
|
|
814
886
|
def _on_Page_loadEventFired(self, params: dict, session: Optional[str]) -> None:
|
|
815
887
|
self._choosers.pop(session, None)
|
|
816
888
|
if (target := self._sessions.get(session)) is not None:
|
|
889
|
+
self._page_loading.discard(target)
|
|
817
890
|
self._spawn(self._refresh(target))
|
|
818
891
|
if (load := self._loading.get(session)) is not None and load.commits:
|
|
819
892
|
load.loaded.add(load.commits[-1])
|
|
@@ -33,6 +33,7 @@ from ..types import METHOD_ADD, RPC_PATH, EnvironmentExtension, IntakeDeclaratio
|
|
|
33
33
|
from . import data
|
|
34
34
|
from .control import AGENT, DOWNLOADS, EXIT, LIVE_START_TAB_TIMEOUT_S, LOADED, STOP, UPLOADS, BrowserControl, _now
|
|
35
35
|
from .devtools import PIPE_IN, PIPE_OUT, DevToolsError, DevToolsPipe
|
|
36
|
+
from .recording import BROWSER_RECORDING, MAX_DURATION_S, MAX_FRAMES, BrowserRecordings
|
|
36
37
|
from .shapes import BrowserRecord, BrowserState, CookieToSet, OriginStorage, SiteNames, StateToLoad
|
|
37
38
|
|
|
38
39
|
logger = logging.getLogger(__name__)
|
|
@@ -155,6 +156,8 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
155
156
|
self.cdp_tokens = Tokens(SOCKET.parent / "cdp-tokens.json")
|
|
156
157
|
self.relay = Relay(self.devtools, dialogs_answered=self.settings.dialogs != AGENT, log=self.log,
|
|
157
158
|
control=self.control)
|
|
159
|
+
#: Its recordings: frames of the tab an agent last acted in, and its log, uploaded under each one's grant.
|
|
160
|
+
self.recordings = BrowserRecordings(self.log, self.control)
|
|
158
161
|
self.devtools.on_close(self._pipe_closed)
|
|
159
162
|
|
|
160
163
|
@classmethod
|
|
@@ -372,6 +375,25 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
372
375
|
raise InvalidArgument(f"no tool call is open as entry {entry}")
|
|
373
376
|
return {}
|
|
374
377
|
|
|
378
|
+
@extension(BROWSER_RECORDING, op="start")
|
|
379
|
+
async def browser_recording_start(self, request_id: str, upload: dict, frames: bool = True) -> dict:
|
|
380
|
+
"""A recording of this browser, its frames and its log uploaded under the write namespace grant ``upload``:
|
|
381
|
+
with ``frames``, a frame of the tab an agent last acted in at the start, after each burst of its actions
|
|
382
|
+
settles and at the end. A start again with the same ``request_id`` answers the recording it began."""
|
|
383
|
+
return await self.recordings.start(request_id, upload, frames)
|
|
384
|
+
|
|
385
|
+
@extension(BROWSER_RECORDING, op="end")
|
|
386
|
+
async def browser_recording_end(self, recording_id: str, upload: Optional[dict] = None,
|
|
387
|
+
reason: str = "end") -> dict:
|
|
388
|
+
"""The recording ``recording_id`` ended, under a fresh grant ``upload`` when one is given: its last frames,
|
|
389
|
+
its log's lines since its start and its manifest uploaded, and the manifest answered."""
|
|
390
|
+
return await self.recordings.end(recording_id, upload, reason)
|
|
391
|
+
|
|
392
|
+
@extension(BROWSER_RECORDING, op="end_all")
|
|
393
|
+
async def browser_recording_end_all(self, reason: str = "teardown") -> dict:
|
|
394
|
+
"""Every open recording ended, under its start's grant, as the env closes or resets: their manifests."""
|
|
395
|
+
return {"recordings": await self.recordings.end_all(reason)}
|
|
396
|
+
|
|
375
397
|
@extension(BROWSER, op="cdp")
|
|
376
398
|
async def browser_cdp(self, user: str, request: Request, origin: Optional[str] = None) -> dict:
|
|
377
399
|
"""``user``'s CDP address once the browser's ready, the same one each time it's asked for, as the server that
|
|
@@ -649,6 +671,8 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
649
671
|
return self.start_tab_launches[-1]["tabs"] if self.start_tab_launches else []
|
|
650
672
|
|
|
651
673
|
def extension_params(self, uri: str) -> dict:
|
|
674
|
+
if uri == BROWSER_RECORDING:
|
|
675
|
+
return {"max_duration_s": MAX_DURATION_S, "max_frames": MAX_FRAMES, "frames": True}
|
|
652
676
|
if uri == BROWSER:
|
|
653
677
|
params: dict[str, Any] = {"chromium": self.version, "clock": "real", "mode": _mode()}
|
|
654
678
|
if _alone():
|
|
@@ -23,7 +23,7 @@ import time
|
|
|
23
23
|
from collections.abc import Mapping
|
|
24
24
|
from datetime import datetime, timezone
|
|
25
25
|
from pathlib import Path
|
|
26
|
-
from typing import Any, Optional
|
|
26
|
+
from typing import Any, Callable, Optional
|
|
27
27
|
from urllib.parse import parse_qsl, quote, urlsplit, urlunsplit
|
|
28
28
|
|
|
29
29
|
logger = logging.getLogger(__name__)
|
|
@@ -314,6 +314,8 @@ class BrowserLog:
|
|
|
314
314
|
self._unwritable = False
|
|
315
315
|
#: Per tab, the sequence number of the latest acting entry on it.
|
|
316
316
|
self.last_acting: dict[str, int] = {}
|
|
317
|
+
#: Each told every action as it's written, its sequence number and its fields, as a recording follows them.
|
|
318
|
+
self.watchers: list[Callable[[int, dict], None]] = []
|
|
317
319
|
|
|
318
320
|
@classmethod
|
|
319
321
|
def for_app(cls, name: str, fallback: Path) -> BrowserLog:
|
|
@@ -381,6 +383,16 @@ class BrowserLog:
|
|
|
381
383
|
self.note("outcome", {"entry": seq, **fields})
|
|
382
384
|
else:
|
|
383
385
|
self.write(seq, {"action": action}, at=begun["at"])
|
|
386
|
+
for watcher in self.watchers:
|
|
387
|
+
try:
|
|
388
|
+
watcher(seq, action)
|
|
389
|
+
except Exception:
|
|
390
|
+
logger.exception("a watcher of the browser's log failed")
|
|
391
|
+
|
|
392
|
+
@property
|
|
393
|
+
def next_seq(self) -> int:
|
|
394
|
+
"""The sequence number the next line will take."""
|
|
395
|
+
return self._seq + 1
|
|
384
396
|
|
|
385
397
|
def note(self, kind: str, body: dict) -> int:
|
|
386
398
|
"""A line of ``kind`` written now: a ``tab`` event, or a ``reset``."""
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"""Recording a website browser, browser-recording/v1: frames of the tab an agent last acted in, one at the start, one
|
|
2
|
+
after each burst of its actions settles and one at the end, each keyed to the log entries it follows and uploaded under
|
|
3
|
+
the recording's grant as it's taken; and, at the end, the log's lines since the start, its actions and tab events, and
|
|
4
|
+
a manifest of it all. A frame the browser couldn't take is in the manifest with why, and counts as missing."""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import base64
|
|
9
|
+
import json
|
|
10
|
+
import logging
|
|
11
|
+
import re
|
|
12
|
+
import uuid
|
|
13
|
+
from datetime import datetime, timezone
|
|
14
|
+
from typing import TYPE_CHECKING, Literal, Optional
|
|
15
|
+
|
|
16
|
+
from pydantic import BaseModel, ValidationError
|
|
17
|
+
|
|
18
|
+
from ..computer.errors import InvalidArgument
|
|
19
|
+
from ..transfers import NamespaceUploader, WriteNamespaceGrant
|
|
20
|
+
from .log import ERROR_CHARS, BrowserLog
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from .control import BrowserControl
|
|
24
|
+
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
|
|
27
|
+
BROWSER_RECORDING = "urn:agentenv:browser-recording/v1"
|
|
28
|
+
MANIFEST = "manifest.json"
|
|
29
|
+
LOG = "log.jsonl"
|
|
30
|
+
FRAMES = "frames"
|
|
31
|
+
REASONS = ("end", "reset", "teardown")
|
|
32
|
+
#: How long a burst of an agent's actions must go quiet before its frame is taken, so typing a word is one frame.
|
|
33
|
+
SETTLE_S = 0.5
|
|
34
|
+
#: How long a frame waits for its tab's page to load after a navigation.
|
|
35
|
+
LOAD_WAIT_S = 5.0
|
|
36
|
+
#: How long a recording may run, which its grant lasts, and how many frames it takes at most.
|
|
37
|
+
MAX_DURATION_S = 4 * 3600
|
|
38
|
+
MAX_FRAMES = 5000
|
|
39
|
+
#: The ways in whose actions are an agent's: CDP commands and MCP tool calls, not agentenv's own.
|
|
40
|
+
AGENTS = ("cdp", "mcp")
|
|
41
|
+
CONTENT_TYPES = {"jpg": "image/jpeg", "png": "image/png"}
|
|
42
|
+
#: How long the recordings a server ended are kept for an end that comes again.
|
|
43
|
+
KEEP_ENDED = 64
|
|
44
|
+
#: How long an end waits for the entries still in flight to be written, so its log covers them, and how often it
|
|
45
|
+
#: looks again.
|
|
46
|
+
LOG_WAIT_S = 10.0
|
|
47
|
+
LOG_POLL_S = 0.2
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class RecordedFrame(BaseModel):
|
|
51
|
+
"""One frame: the first, one after a burst of actions, whose entries it names in ``after``, or the last; its tab
|
|
52
|
+
and URL, and its file under the recording's folder, or why there is none. Its ``kind`` and ``at`` are None where
|
|
53
|
+
they aren't known, in a manifest rebuilt from the files a recording uploaded."""
|
|
54
|
+
|
|
55
|
+
index: int
|
|
56
|
+
kind: Optional[Literal["first", "action", "last"]] = None
|
|
57
|
+
at: Optional[str] = None
|
|
58
|
+
after: list[int] = []
|
|
59
|
+
tab: Optional[str] = None
|
|
60
|
+
url: Optional[str] = None
|
|
61
|
+
path: Optional[str] = None
|
|
62
|
+
content_type: Optional[str] = None
|
|
63
|
+
uploaded: bool = False
|
|
64
|
+
error: Optional[str] = None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class BrowserRecordingManifest(BaseModel):
|
|
68
|
+
"""A recording as it ended: its frames, and its log's lines, entries ``log_after`` + 1 to ``log_last``, as
|
|
69
|
+
``log``, the actions and tab events between its start and its end, with any of those entries it doesn't hold, still
|
|
70
|
+
unwritten or unreadable at its end, in ``log_missing``."""
|
|
71
|
+
|
|
72
|
+
recording_id: str
|
|
73
|
+
started_at: str
|
|
74
|
+
ended_at: Optional[str] = None
|
|
75
|
+
ended_by: Optional[Literal["end", "reset", "teardown", "error"]] = None
|
|
76
|
+
error: Optional[str] = None
|
|
77
|
+
frames_on: bool = True
|
|
78
|
+
frames: list[RecordedFrame] = []
|
|
79
|
+
log: Optional[str] = None
|
|
80
|
+
log_after: int = 0
|
|
81
|
+
log_last: int = 0
|
|
82
|
+
log_uploaded: bool = False
|
|
83
|
+
log_missing: list[int] = []
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def missing_frames(self) -> int:
|
|
87
|
+
return sum(1 for frame in self.frames if not frame.uploaded)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def frame_path(index: int, extension: str) -> str:
|
|
91
|
+
"""Where frame ``index`` uploads, under its recording's folder."""
|
|
92
|
+
return f"{FRAMES}/{index:04d}.{extension}"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def frame_of(path: str) -> Optional[tuple[int, str]]:
|
|
96
|
+
"""The index and content type of the frame ``frame_path`` put at ``path``, or None for another file."""
|
|
97
|
+
if (found := re.fullmatch(rf"{FRAMES}/(\d+)\.(\w+)", path)) and found[2] in CONTENT_TYPES:
|
|
98
|
+
return int(found[1]), CONTENT_TYPES[found[2]]
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class BrowserRecordings:
|
|
103
|
+
"""The recordings of the browser that ``log`` and ``control`` are, followed from the log as its actions are
|
|
104
|
+
written."""
|
|
105
|
+
|
|
106
|
+
def __init__(self, log: BrowserLog, control: BrowserControl) -> None:
|
|
107
|
+
self.log, self.control = log, control
|
|
108
|
+
self._open: dict[str, _Recording] = {}
|
|
109
|
+
self._by_request: dict[str, str] = {}
|
|
110
|
+
self._ended: dict[str, dict] = {}
|
|
111
|
+
log.watchers.append(self.acted)
|
|
112
|
+
|
|
113
|
+
async def start(self, request_id: str, upload: dict, frames: bool = True) -> dict:
|
|
114
|
+
"""A recording under the grant ``upload``, or the one a start with the same ``request_id`` began, which a
|
|
115
|
+
retried start joins: its ``recording_id`` and ``started_at``."""
|
|
116
|
+
if (known := self._by_request.get(request_id)) in self._open:
|
|
117
|
+
recording = self._open[known]
|
|
118
|
+
return {"recording_id": recording.manifest.recording_id, "started_at": recording.manifest.started_at}
|
|
119
|
+
recording = _Recording(self, _grant(upload), frames)
|
|
120
|
+
self._open[recording.manifest.recording_id] = recording
|
|
121
|
+
self._by_request[request_id] = recording.manifest.recording_id
|
|
122
|
+
if frames:
|
|
123
|
+
await recording.take("first")
|
|
124
|
+
return {"recording_id": recording.manifest.recording_id, "started_at": recording.manifest.started_at}
|
|
125
|
+
|
|
126
|
+
async def end(self, recording_id: str, upload: Optional[dict] = None, reason: str = "end") -> dict:
|
|
127
|
+
"""The recording ended, its last frames taken and its log and manifest uploaded, under ``upload`` when one is
|
|
128
|
+
given, else under its start's grant: its manifest. One already ended answers its manifest again."""
|
|
129
|
+
if reason not in REASONS:
|
|
130
|
+
raise InvalidArgument(f"reason is one of {', '.join(REASONS)}, not {reason!r}")
|
|
131
|
+
if recording_id in self._ended:
|
|
132
|
+
return self._ended[recording_id]
|
|
133
|
+
recording = self._open.get(recording_id)
|
|
134
|
+
if recording is None:
|
|
135
|
+
raise InvalidArgument(f"no recording {recording_id} is open here")
|
|
136
|
+
manifest = await recording.end(_grant(upload) if upload is not None else None, reason)
|
|
137
|
+
self._open.pop(recording_id, None)
|
|
138
|
+
self._ended[recording_id] = manifest
|
|
139
|
+
while len(self._ended) > KEEP_ENDED:
|
|
140
|
+
self._ended.pop(next(iter(self._ended)))
|
|
141
|
+
return manifest
|
|
142
|
+
|
|
143
|
+
async def end_all(self, reason: str = "teardown") -> list[dict]:
|
|
144
|
+
"""Every open recording ended, as its env closes or resets."""
|
|
145
|
+
return [await self.end(recording_id, None, reason) for recording_id in list(self._open)]
|
|
146
|
+
|
|
147
|
+
def acted(self, seq: int, action: dict) -> None:
|
|
148
|
+
"""An action written to the log: an agent's acting one starts, or holds back, the frame of its burst."""
|
|
149
|
+
if action.get("acts") and action.get("via") in AGENTS:
|
|
150
|
+
for recording in self._open.values():
|
|
151
|
+
recording.acted(seq, action.get("tab"))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class _Recording:
|
|
155
|
+
def __init__(self, recordings: BrowserRecordings, grant: WriteNamespaceGrant, frames: bool) -> None:
|
|
156
|
+
self.recordings, self.uploader, self.frames_on = recordings, NamespaceUploader(grant), frames
|
|
157
|
+
recording_id = uuid.uuid4().hex
|
|
158
|
+
self.manifest = BrowserRecordingManifest(recording_id=recording_id, started_at=_iso(), frames_on=frames,
|
|
159
|
+
log_after=recordings.log.next_seq - 1)
|
|
160
|
+
#: The acting entries since the last frame, and the tab the latest of them was on.
|
|
161
|
+
self.pending: list[int] = []
|
|
162
|
+
self.tab: Optional[str] = None
|
|
163
|
+
self._timer: Optional[asyncio.TimerHandle] = None
|
|
164
|
+
self._taking: set[asyncio.Future] = set()
|
|
165
|
+
self._lock = asyncio.Lock()
|
|
166
|
+
self._ending = False
|
|
167
|
+
|
|
168
|
+
def acted(self, seq: int, tab: Optional[str]) -> None:
|
|
169
|
+
if not self.frames_on or self._ending:
|
|
170
|
+
return
|
|
171
|
+
self.pending.append(seq)
|
|
172
|
+
if tab:
|
|
173
|
+
self.tab = tab
|
|
174
|
+
if self._timer is not None:
|
|
175
|
+
self._timer.cancel()
|
|
176
|
+
self._timer = asyncio.get_running_loop().call_later(SETTLE_S, self._settled)
|
|
177
|
+
|
|
178
|
+
def _settled(self) -> None:
|
|
179
|
+
self._timer = None
|
|
180
|
+
taking = asyncio.ensure_future(self.take("action"))
|
|
181
|
+
self._taking.add(taking)
|
|
182
|
+
taking.add_done_callback(self._taking.discard)
|
|
183
|
+
|
|
184
|
+
async def take(self, kind: str) -> None:
|
|
185
|
+
"""The frame of ``kind``, of the tab the agent last acted in, uploaded as it's taken; one an action burst
|
|
186
|
+
brings only once that burst has entries no frame followed yet."""
|
|
187
|
+
async with self._lock:
|
|
188
|
+
after, self.pending = self.pending, []
|
|
189
|
+
if kind == "action" and not after:
|
|
190
|
+
return
|
|
191
|
+
index = len(self.manifest.frames)
|
|
192
|
+
frame = RecordedFrame(index=index, kind=kind, at=_iso(), after=after, tab=self.tab)
|
|
193
|
+
self.manifest.frames.append(frame)
|
|
194
|
+
if index >= MAX_FRAMES:
|
|
195
|
+
frame.error = f"the recording reached its {MAX_FRAMES} frames"
|
|
196
|
+
return
|
|
197
|
+
try:
|
|
198
|
+
data, extension, frame.tab, frame.url = await self.recordings.control.frame(self.tab, LOAD_WAIT_S)
|
|
199
|
+
frame.at = _iso()
|
|
200
|
+
frame.path, frame.content_type = frame_path(index, extension), CONTENT_TYPES[extension]
|
|
201
|
+
await self.uploader.upload(self._path(frame.path), base64.b64decode(data))
|
|
202
|
+
frame.uploaded = True
|
|
203
|
+
except Exception as e:
|
|
204
|
+
frame.error = f"{type(e).__name__}: {e}"[:ERROR_CHARS]
|
|
205
|
+
logger.warning("browser recording %s: frame %d: %s", self.manifest.recording_id, index, frame.error)
|
|
206
|
+
|
|
207
|
+
async def end(self, grant: Optional[WriteNamespaceGrant], reason: str) -> dict:
|
|
208
|
+
self._ending = True
|
|
209
|
+
if self._timer is not None:
|
|
210
|
+
self._timer.cancel()
|
|
211
|
+
self._timer = None
|
|
212
|
+
await asyncio.gather(*self._taking, return_exceptions=True)
|
|
213
|
+
if grant is not None:
|
|
214
|
+
self.uploader = NamespaceUploader(grant)
|
|
215
|
+
if self.frames_on:
|
|
216
|
+
await self.take("action")
|
|
217
|
+
await self.take("last")
|
|
218
|
+
manifest = self.manifest
|
|
219
|
+
manifest.log_last = self.recordings.log.next_seq - 1
|
|
220
|
+
lines = await self._log_lines()
|
|
221
|
+
manifest.log_missing = sorted(set(range(manifest.log_after + 1, manifest.log_last + 1))
|
|
222
|
+
- {line.get("seq") for line in lines})
|
|
223
|
+
text = "".join(json.dumps(line, default=str) + "\n" for line in lines)
|
|
224
|
+
manifest.log = LOG
|
|
225
|
+
try:
|
|
226
|
+
await self.uploader.upload(self._path(LOG), text.encode())
|
|
227
|
+
manifest.log_uploaded = True
|
|
228
|
+
except Exception as e:
|
|
229
|
+
manifest.error = f"the log didn't upload: {type(e).__name__}: {e}"[:ERROR_CHARS]
|
|
230
|
+
manifest.ended_at, manifest.ended_by = _iso(), reason
|
|
231
|
+
wire = manifest.model_dump(mode="json")
|
|
232
|
+
try:
|
|
233
|
+
await self.uploader.upload(self._path(MANIFEST), json.dumps(wire, indent=1).encode())
|
|
234
|
+
except Exception as e:
|
|
235
|
+
logger.warning("browser recording %s: its manifest didn't upload: %s", manifest.recording_id, e)
|
|
236
|
+
return wire
|
|
237
|
+
|
|
238
|
+
async def _log_lines(self) -> list[dict]:
|
|
239
|
+
"""The log's lines from the recording's start to its end, once every one of them is written, or what's
|
|
240
|
+
written of them after ``LOG_WAIT_S``."""
|
|
241
|
+
manifest, log = self.manifest, self.recordings.log
|
|
242
|
+
deadline = asyncio.get_running_loop().time() + LOG_WAIT_S
|
|
243
|
+
wanted = manifest.log_last - manifest.log_after
|
|
244
|
+
while True:
|
|
245
|
+
lines = [line for line in (await log.read_async(manifest.log_after, limit=wanted))["lines"]
|
|
246
|
+
if line.get("seq", 0) <= manifest.log_last]
|
|
247
|
+
if len(lines) >= wanted or asyncio.get_running_loop().time() >= deadline:
|
|
248
|
+
return lines
|
|
249
|
+
await asyncio.sleep(LOG_POLL_S)
|
|
250
|
+
|
|
251
|
+
def _path(self, name: str) -> str:
|
|
252
|
+
return f"{self.manifest.recording_id}/{name}"
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def _grant(upload: object) -> WriteNamespaceGrant:
|
|
256
|
+
try:
|
|
257
|
+
return WriteNamespaceGrant.model_validate(upload)
|
|
258
|
+
except ValidationError as e:
|
|
259
|
+
raise InvalidArgument(f"upload must be a write namespace grant: {e.errors()[0]['msg']}") from None
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def _iso() -> str:
|
|
263
|
+
return datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
|