agentenv-framework-protocol 0.1.548__tar.gz → 0.1.550__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.548 → agentenv_framework_protocol-0.1.550}/PKG-INFO +31 -12
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/README.md +30 -11
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/recording.py +39 -21
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/cdp.py +4 -2
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/contexts.py +14 -6
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/control.py +119 -11
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/environment.py +20 -9
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/network.py +7 -0
- agentenv_framework_protocol-0.1.550/src/agentenv_protocol/website_browser/recording.py +621 -0
- agentenv_framework_protocol-0.1.550/src/agentenv_protocol/website_browser/stream.py +219 -0
- agentenv_framework_protocol-0.1.550/tests/test_browser_recording.py +826 -0
- agentenv_framework_protocol-0.1.548/src/agentenv_protocol/website_browser/recording.py +0 -274
- agentenv_framework_protocol-0.1.548/tests/test_browser_recording.py +0 -434
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/clock.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/passthrough.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/log.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/scope.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_contexts.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_log.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_network.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_clock.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_conformance_attempts.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.548 → agentenv_framework_protocol-0.1.550}/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.550
|
|
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
|
|
@@ -1265,17 +1265,36 @@ are the profile's template. The base class adds:
|
|
|
1265
1265
|
The server keeps each token in memory and only its SHA-256, with its user and base address, in
|
|
1266
1266
|
`.agentenv/cdp-tokens.json`, which code in the computer's session can read but not use; an address
|
|
1267
1267
|
outlives a relaunch of the browser and of the server, and the computer's reset ends it.
|
|
1268
|
-
- **`browser-recording/v1`** on its card, framework-only,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1268
|
+
- **`browser-recording/v1`** on its card, framework-only: one recording per context, a lease's or the default
|
|
1269
|
+
one's. Its params name what it records (`video`, `frames`, `network`, `context`) and its limits (`fps`,
|
|
1270
|
+
`max_duration_s`, `max_frames`, `max_open`, `max_children`, `max_objects`).
|
|
1271
|
+
`start {request_id, upload, context?, fps?, network?, frames?, max_edge?}` records the lease `context` names, else
|
|
1272
|
+
the default context, under the write namespace grant `upload`, a start again with the same `request_id` answering
|
|
1273
|
+
the recording it began; `end {recording_id, upload?, reason?}` ends it, under a fresh grant when one is given, and
|
|
1274
|
+
answers its manifest (`BrowserRecordingManifest`); `end_all {reason?}` ends every open one. A recording has:
|
|
1275
|
+
- **a video** of the tab its context's agent is on, at `fps` (10 by default, 15 at most), encoded as
|
|
1276
|
+
`computer-recording/v1`'s is and uploaded a segment at a time under `<recording_id>/video/`. It follows the tab an
|
|
1277
|
+
agent last acted on in that context (CDP commands and MCP calls, not agentenv's own), a tab that one opens as
|
|
1278
|
+
soon as it opens, and once it closes the tab followed before it, else the context's newest; it's blank while the
|
|
1279
|
+
context has no tab. The browser's own connection screencasts that tab, and captures it instead while it sends no
|
|
1280
|
+
frame, as a tab behind another in its window does; `video.followed` says which tab showed when, and how.
|
|
1281
|
+
- **its log**: at the end, the lines of its context since its start, actions and tab events on its tabs and a
|
|
1282
|
+
scoped connection's actions on none, as `log.jsonl`.
|
|
1283
|
+
- **the network log**, by default when the browser keeps one, as a browser alone does and one in a desktop
|
|
1284
|
+
computer doesn't (`network` false leaves it out, true refuses a browser with none): the browser's whole log at
|
|
1285
|
+
the end as `network.har`, so the start tabs' loads are in it, every context's requests among them; the manifest
|
|
1286
|
+
marks it browser-wide, with the log lines written while it ran (`during`) and the leases open meanwhile.
|
|
1287
|
+
- **frames**, with `frames` (off by default): a JPEG of the tab the video follows at the start, after each burst of
|
|
1288
|
+
an agent's acting entries has gone quiet for 0.5 s and its page has loaded (up to 5 s), and at the end, under
|
|
1289
|
+
`<recording_id>/frames/`, keyed to the entries it follows (`after`); a frame it couldn't take is kept with its
|
|
1290
|
+
`error`.
|
|
1291
|
+
- **children**: a context an agent makes over an address scoped to the recorded context is recorded with it, its
|
|
1292
|
+
own video, log and frames under `<recording_id>/contexts/<label>/`, until its context or the recording ends.
|
|
1293
|
+
A lease's recording ends with the lease (`context_ended`). The server encodes with PyAV and Pillow, which agentenv's
|
|
1294
|
+
chromium installs through its own requirements; an app without them refuses a start. `start_browser_recording` and
|
|
1295
|
+
`end_browser_recording` run it, registering everything it uploaded as one file artifact universe, and the end fails
|
|
1296
|
+
the run when any of it is missing. The page driver's `computer-recording/v1` is a different recording: the page tab
|
|
1297
|
+
as pixel tools see it, across contexts.
|
|
1279
1298
|
- **Its CDP relay**, at those addresses: `json/version` and `json/list` (also with a trailing slash,
|
|
1280
1299
|
and `json`) answered from the browser, since a browser on a pipe has none, with its WebSocket at the
|
|
1281
1300
|
address the client reached it at; and `devtools/browser`, where each WebSocket connection gets a
|
|
@@ -1194,17 +1194,36 @@ are the profile's template. The base class adds:
|
|
|
1194
1194
|
The server keeps each token in memory and only its SHA-256, with its user and base address, in
|
|
1195
1195
|
`.agentenv/cdp-tokens.json`, which code in the computer's session can read but not use; an address
|
|
1196
1196
|
outlives a relaunch of the browser and of the server, and the computer's reset ends it.
|
|
1197
|
-
- **`browser-recording/v1`** on its card, framework-only,
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1197
|
+
- **`browser-recording/v1`** on its card, framework-only: one recording per context, a lease's or the default
|
|
1198
|
+
one's. Its params name what it records (`video`, `frames`, `network`, `context`) and its limits (`fps`,
|
|
1199
|
+
`max_duration_s`, `max_frames`, `max_open`, `max_children`, `max_objects`).
|
|
1200
|
+
`start {request_id, upload, context?, fps?, network?, frames?, max_edge?}` records the lease `context` names, else
|
|
1201
|
+
the default context, under the write namespace grant `upload`, a start again with the same `request_id` answering
|
|
1202
|
+
the recording it began; `end {recording_id, upload?, reason?}` ends it, under a fresh grant when one is given, and
|
|
1203
|
+
answers its manifest (`BrowserRecordingManifest`); `end_all {reason?}` ends every open one. A recording has:
|
|
1204
|
+
- **a video** of the tab its context's agent is on, at `fps` (10 by default, 15 at most), encoded as
|
|
1205
|
+
`computer-recording/v1`'s is and uploaded a segment at a time under `<recording_id>/video/`. It follows the tab an
|
|
1206
|
+
agent last acted on in that context (CDP commands and MCP calls, not agentenv's own), a tab that one opens as
|
|
1207
|
+
soon as it opens, and once it closes the tab followed before it, else the context's newest; it's blank while the
|
|
1208
|
+
context has no tab. The browser's own connection screencasts that tab, and captures it instead while it sends no
|
|
1209
|
+
frame, as a tab behind another in its window does; `video.followed` says which tab showed when, and how.
|
|
1210
|
+
- **its log**: at the end, the lines of its context since its start, actions and tab events on its tabs and a
|
|
1211
|
+
scoped connection's actions on none, as `log.jsonl`.
|
|
1212
|
+
- **the network log**, by default when the browser keeps one, as a browser alone does and one in a desktop
|
|
1213
|
+
computer doesn't (`network` false leaves it out, true refuses a browser with none): the browser's whole log at
|
|
1214
|
+
the end as `network.har`, so the start tabs' loads are in it, every context's requests among them; the manifest
|
|
1215
|
+
marks it browser-wide, with the log lines written while it ran (`during`) and the leases open meanwhile.
|
|
1216
|
+
- **frames**, with `frames` (off by default): a JPEG of the tab the video follows at the start, after each burst of
|
|
1217
|
+
an agent's acting entries has gone quiet for 0.5 s and its page has loaded (up to 5 s), and at the end, under
|
|
1218
|
+
`<recording_id>/frames/`, keyed to the entries it follows (`after`); a frame it couldn't take is kept with its
|
|
1219
|
+
`error`.
|
|
1220
|
+
- **children**: a context an agent makes over an address scoped to the recorded context is recorded with it, its
|
|
1221
|
+
own video, log and frames under `<recording_id>/contexts/<label>/`, until its context or the recording ends.
|
|
1222
|
+
A lease's recording ends with the lease (`context_ended`). The server encodes with PyAV and Pillow, which agentenv's
|
|
1223
|
+
chromium installs through its own requirements; an app without them refuses a start. `start_browser_recording` and
|
|
1224
|
+
`end_browser_recording` run it, registering everything it uploaded as one file artifact universe, and the end fails
|
|
1225
|
+
the run when any of it is missing. The page driver's `computer-recording/v1` is a different recording: the page tab
|
|
1226
|
+
as pixel tools see it, across contexts.
|
|
1208
1227
|
- **Its CDP relay**, at those addresses: `json/version` and `json/list` (also with a trailing slash,
|
|
1209
1228
|
and `json`) answered from the browser, since a browser on a pipe has none, with its WebSocket at the
|
|
1210
1229
|
address the client reached it at; and `devtools/browser`, where each WebSocket connection gets a
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Recording a computer's display, computer-recording/v1: the base class runs each recording from the driver's
|
|
2
2
|
``@record`` stream, or by polling ``@capture`` where the driver has none, encodes frames as H.264 segments, uploads
|
|
3
|
-
each segment as it closes and seals the recording at ``end`` with its manifest.
|
|
3
|
+
each segment as it closes and seals the recording at ``end`` with its manifest. ``Video`` is that recording, from any
|
|
4
|
+
source of frames, which a website browser's recordings (browser-recording/v1) use too."""
|
|
4
5
|
from __future__ import annotations
|
|
5
6
|
|
|
6
7
|
import asyncio
|
|
@@ -135,7 +136,7 @@ class Recordings:
|
|
|
135
136
|
|
|
136
137
|
def __init__(self, runtime: ComputerRuntime) -> None:
|
|
137
138
|
self.runtime = runtime
|
|
138
|
-
self.running: dict[str,
|
|
139
|
+
self.running: dict[str, Video] = {}
|
|
139
140
|
self.ended: OrderedDict[str, dict] = OrderedDict()
|
|
140
141
|
self.started: OrderedDict[str, dict] = OrderedDict()
|
|
141
142
|
self._lock = asyncio.Lock()
|
|
@@ -161,10 +162,13 @@ class Recordings:
|
|
|
161
162
|
root = Path.home() / RECORDINGS_DIR
|
|
162
163
|
hints = dataclasses.replace(hints, directory=root / recording_id)
|
|
163
164
|
hints.directory.mkdir(parents=True, exist_ok=True)
|
|
164
|
-
|
|
165
|
+
streams, runtime = self.runtime.has("record"), self.runtime
|
|
166
|
+
cursor = hints.cursor if streams else hints.cursor and runtime.has("pointer")
|
|
167
|
+
source = (lambda hints: runtime.stream(hints)) if streams else \
|
|
168
|
+
(lambda hints: _poll(runtime, hints, cursor))
|
|
169
|
+
recording = Video(recording_id, hints, features, root, grant, source, streams=streams, cursor=cursor)
|
|
165
170
|
self.running[recording_id] = recording
|
|
166
|
-
recording.
|
|
167
|
-
recording.timer = asyncio.get_running_loop().call_later(features.max_duration_s, recording.expire)
|
|
171
|
+
recording.begin()
|
|
168
172
|
answer = {"recording_id": recording_id, "started_at": _iso(recording.requested_at), "format": MP4}
|
|
169
173
|
self.started[request_id] = answer
|
|
170
174
|
while len(self.started) > KEEP_STARTED:
|
|
@@ -173,11 +177,9 @@ class Recordings:
|
|
|
173
177
|
return answer
|
|
174
178
|
|
|
175
179
|
@staticmethod
|
|
176
|
-
async def _live(recording: Optional[
|
|
177
|
-
"""Wait up to FIRST_FRAME_S for ``recording``, one still running, to have its first frame."""
|
|
180
|
+
async def _live(recording: Optional[Video]) -> None:
|
|
178
181
|
if recording is not None:
|
|
179
|
-
|
|
180
|
-
await asyncio.wait_for(recording.live.wait(), FIRST_FRAME_S)
|
|
182
|
+
await recording.until_live()
|
|
181
183
|
|
|
182
184
|
async def end(self, recording_id: str, upload: Optional[dict], reason: str) -> dict:
|
|
183
185
|
if reason not in REASONS:
|
|
@@ -215,18 +217,26 @@ class Recordings:
|
|
|
215
217
|
return RecordHints(scope, fps, max_edge, bool(cursor), features.max_segment_s, Path()), grant
|
|
216
218
|
|
|
217
219
|
|
|
218
|
-
class
|
|
220
|
+
class Video:
|
|
221
|
+
"""One recording's video: frames or segments from ``source(hints)``, encoded as H.264 segments in
|
|
222
|
+
``hints.directory``, each uploaded under ``grant`` as it closes, at ``<prefix>/<index>.mp4``, ``prefix`` its id by
|
|
223
|
+
default; sealed by ``end``, which answers its manifest and, with ``manifest``, uploads it beside the segments.
|
|
224
|
+
``streams`` says the source streams rather than polls, ``cursor`` that its frames draw the pointer."""
|
|
225
|
+
|
|
219
226
|
def __init__(self, recording_id: str, hints: RecordHints, features: Recording, root: Path,
|
|
220
|
-
grant: Optional[WriteNamespaceGrant],
|
|
227
|
+
grant: Optional[WriteNamespaceGrant], source: Callable[[RecordHints], AsyncIterator], *,
|
|
228
|
+
streams: bool, cursor: bool, prefix: Optional[str] = None, manifest: bool = True) -> None:
|
|
221
229
|
self.id = recording_id
|
|
222
230
|
self.hints = hints
|
|
223
231
|
self.features = features
|
|
224
232
|
self.root = root
|
|
225
|
-
self.
|
|
233
|
+
self.source = source
|
|
234
|
+
self.prefix = prefix or recording_id
|
|
235
|
+
self.uploads_manifest = manifest
|
|
226
236
|
self.uploader = NamespaceUploader(grant) if grant is not None else None
|
|
227
237
|
self.requested_at = datetime.now(timezone.utc)
|
|
228
|
-
self.streams =
|
|
229
|
-
self.cursor =
|
|
238
|
+
self.streams = streams
|
|
239
|
+
self.cursor = cursor
|
|
230
240
|
self.segments: list[_Segment] = []
|
|
231
241
|
self.encoder: Optional[_Encoder] = None
|
|
232
242
|
self.ended_by: Optional[str] = None
|
|
@@ -241,6 +251,16 @@ class _Recording:
|
|
|
241
251
|
self.executor = ThreadPoolExecutor(max_workers=1, thread_name_prefix=f"computer-{recording_id}")
|
|
242
252
|
self._last_disk_check = 0.0
|
|
243
253
|
|
|
254
|
+
def begin(self) -> None:
|
|
255
|
+
"""Recording from now, until ``end`` or ``max_duration_s``."""
|
|
256
|
+
self.task = asyncio.create_task(self.run())
|
|
257
|
+
self.timer = asyncio.get_running_loop().call_later(self.features.max_duration_s, self.expire)
|
|
258
|
+
|
|
259
|
+
async def until_live(self) -> None:
|
|
260
|
+
"""Wait up to FIRST_FRAME_S for it, still running, to have its first frame."""
|
|
261
|
+
with contextlib.suppress(TimeoutError):
|
|
262
|
+
await asyncio.wait_for(self.live.wait(), FIRST_FRAME_S)
|
|
263
|
+
|
|
244
264
|
async def run(self) -> None:
|
|
245
265
|
"""Frames or segments from the source, recorded until the recording ends; ``live`` once it's recording: a
|
|
246
266
|
stream from its start, the fallback's polling from its first frame, which a busy computer is slow to take."""
|
|
@@ -289,9 +309,7 @@ class _Recording:
|
|
|
289
309
|
self.executor.shutdown(wait=False)
|
|
290
310
|
|
|
291
311
|
def _source(self) -> AsyncIterator:
|
|
292
|
-
|
|
293
|
-
return self.runtime.stream(self.hints)
|
|
294
|
-
return _poll(self.runtime, self.hints, self.cursor)
|
|
312
|
+
return self.source(self.hints)
|
|
295
313
|
|
|
296
314
|
async def end(self, reason: str, grant: Optional[WriteNamespaceGrant]) -> dict:
|
|
297
315
|
if self.timer is not None:
|
|
@@ -318,9 +336,9 @@ class _Recording:
|
|
|
318
336
|
source="stream" if self.streams else "capture", started_at=entries[0].started_at if entries else None,
|
|
319
337
|
ended_at=entries[-1].ended_at if entries else None, ended_by=self.ended_by, segments=entries,
|
|
320
338
|
error=self.error if self.ended_by == "error" else None).wire()
|
|
321
|
-
if uploader is not None: # beside the segments, so a reader who didn't end the
|
|
322
|
-
with contextlib.suppress(Exception):
|
|
323
|
-
await uploader.upload(f"{self.
|
|
339
|
+
if uploader is not None and self.uploads_manifest: # beside the segments, so a reader who didn't end the
|
|
340
|
+
with contextlib.suppress(Exception): # recording finds it
|
|
341
|
+
await uploader.upload(f"{self.prefix}/{MANIFEST}", json.dumps(manifest).encode())
|
|
324
342
|
return manifest
|
|
325
343
|
|
|
326
344
|
async def _add_frame(self, item: RecordedFrame) -> None:
|
|
@@ -373,7 +391,7 @@ class _Recording:
|
|
|
373
391
|
frames: int) -> None:
|
|
374
392
|
size, digest = await asyncio.to_thread(_digest, path)
|
|
375
393
|
segment = _Segment(ManifestSegment(
|
|
376
|
-
index=len(self.segments), path=f"{self.
|
|
394
|
+
index=len(self.segments), path=f"{self.prefix}/{path.name}", started_at=_iso(started_at),
|
|
377
395
|
ended_at=_iso(ended_at), width=width, height=height, frames=frames, bytes=size, sha256=digest,
|
|
378
396
|
uploaded=False), path)
|
|
379
397
|
self.segments.append(segment)
|
|
@@ -472,7 +472,8 @@ class Relay:
|
|
|
472
472
|
if self.contexts is None:
|
|
473
473
|
return
|
|
474
474
|
if method == MAKES_CONTEXT and isinstance(made := result.get("browserContextId"), str):
|
|
475
|
-
self.contexts.made_by_agent(connection.user, made
|
|
475
|
+
self.contexts.made_by_agent(connection.user, made,
|
|
476
|
+
connection.scope.lease if connection.scope is not None else None)
|
|
476
477
|
if params.get("disposeOnDetach"):
|
|
477
478
|
connection.ends_on_detach.add(made)
|
|
478
479
|
elif method == ENDS_CONTEXT:
|
|
@@ -501,7 +502,8 @@ class Relay:
|
|
|
501
502
|
url = self.control.url_of(target) if self.control is not None and target else None
|
|
502
503
|
crediting = [call for call in self.calls.values() if call.user == connection.user]
|
|
503
504
|
action = {"via": "cdp", "who": connection.user, "connection": connection.number, "method": method,
|
|
504
|
-
"acts": acting, "tab": target, "url": url
|
|
505
|
+
"acts": acting, "tab": target, "url": url,
|
|
506
|
+
**({"context": connection.record["context"]} if "context" in connection.record else {})}
|
|
505
507
|
if crediting:
|
|
506
508
|
action["for"] = crediting[0].begun["seq"] if len(crediting) == 1 else [c.begun["seq"] for c in crediting]
|
|
507
509
|
return _Logged(self, self.log.begin(action), method, params, target, acting, crediting)
|
|
@@ -79,8 +79,10 @@ class Contexts:
|
|
|
79
79
|
home: Callable[[], Path] = Path.home) -> None:
|
|
80
80
|
self.devtools, self.control, self.home = devtools, control, home
|
|
81
81
|
self.leases: dict[str, Lease] = {}
|
|
82
|
-
#: What hears of each lease's end, whatever ends it: its release, its disposal or the browser's
|
|
82
|
+
#: What hears of each lease's end, whatever ends it: its release, its disposal or the browser's; and of each
|
|
83
|
+
#: lease made, with the context the connection that made it is scoped to, None for the default context's.
|
|
83
84
|
self.on_end: list[Callable[[Lease], None]] = []
|
|
85
|
+
self.on_made: list[Callable[[Lease, Optional[str]], None]] = []
|
|
84
86
|
self._made: dict[str, int] = {}
|
|
85
87
|
self._tasks: set[asyncio.Future] = set()
|
|
86
88
|
self._lock = asyncio.Lock()
|
|
@@ -143,12 +145,13 @@ class Contexts:
|
|
|
143
145
|
await asyncio.to_thread(shutil.rmtree, lease.folder(self.home()), True)
|
|
144
146
|
return True
|
|
145
147
|
|
|
146
|
-
def made_by_agent(self, user: str, context_id: str) -> Lease:
|
|
147
|
-
"""The context ``context_id`` an agent made over CDP as ``user``,
|
|
148
|
-
starting empty, its downloads sent
|
|
148
|
+
def made_by_agent(self, user: str, context_id: str, scope: Optional[str] = None) -> Lease:
|
|
149
|
+
"""The context ``context_id`` an agent made over CDP as ``user``, on a connection scoped to the context
|
|
150
|
+
``scope``, None for the default one, leased to it as ``agent-<user>-<n>``, starting empty, its downloads sent
|
|
151
|
+
to its own folder."""
|
|
149
152
|
if (known := self.of(context_id)) is not None:
|
|
150
153
|
return known
|
|
151
|
-
lease = self._record(Lease(self._agent_label(user), context_id, user, [user]))
|
|
154
|
+
lease = self._record(Lease(self._agent_label(user), context_id, user, [user]), scope)
|
|
152
155
|
self._spawn(self._send_downloads(lease))
|
|
153
156
|
return lease
|
|
154
157
|
|
|
@@ -219,10 +222,15 @@ class Contexts:
|
|
|
219
222
|
except Exception as e:
|
|
220
223
|
logger.warning(f"the end of the lease {lease.label!r}: {type(e).__name__}: {e}")
|
|
221
224
|
|
|
222
|
-
def _record(self, lease: Lease) -> Lease:
|
|
225
|
+
def _record(self, lease: Lease, scope: Optional[str] = None) -> Lease:
|
|
223
226
|
self.leases[lease.label] = lease
|
|
224
227
|
self.control.other_contexts[lease.id] = lease.label
|
|
225
228
|
lease.downloads(self.home()).mkdir(parents=True, exist_ok=True)
|
|
229
|
+
for hook in self.on_made:
|
|
230
|
+
try:
|
|
231
|
+
hook(lease, scope)
|
|
232
|
+
except Exception as e:
|
|
233
|
+
logger.warning(f"the lease {lease.label!r} made: {type(e).__name__}: {e}")
|
|
226
234
|
return lease
|
|
227
235
|
|
|
228
236
|
def _agent_label(self, user: str) -> str:
|
|
@@ -59,6 +59,8 @@ FRAME_RETRY_S = 0.25
|
|
|
59
59
|
FOR_THE_MOMENT = ("Not attached to an active page", "Unable to capture screenshot", "Session with given id not found")
|
|
60
60
|
#: How often a wait for a tab to load looks again.
|
|
61
61
|
LOAD_POLL_S = 0.1
|
|
62
|
+
#: A screencast's frames: JPEG at this quality, every frame the tab paints.
|
|
63
|
+
SCREENCAST = {"format": "jpeg", "quality": FRAME_QUALITY, "everyNthFrame": 1}
|
|
62
64
|
#: Where an agent's files to upload are, and where downloads land, under the session user's home.
|
|
63
65
|
UPLOADS = "Uploads"
|
|
64
66
|
DOWNLOADS = "Downloads"
|
|
@@ -139,6 +141,10 @@ class BrowserControl:
|
|
|
139
141
|
self.other_contexts: dict[str, str] = {}
|
|
140
142
|
self.context_origins: dict[str, set[str]] = {}
|
|
141
143
|
self._context_fronts: dict[str, str] = {}
|
|
144
|
+
#: Each screencast agentenv runs, by its session, and what hears its frames, each JPEG's bytes.
|
|
145
|
+
self._screencasts: dict[str, list[Callable[[bytes], None]]] = {}
|
|
146
|
+
#: What hears of each tab opening and closing: the event and the tab's record.
|
|
147
|
+
self.on_tab: list[Callable[[str, dict], None]] = []
|
|
142
148
|
#: The browser's log, where its tab events go, and the commands in flight that cause them.
|
|
143
149
|
self.log: Optional[BrowserLog] = None
|
|
144
150
|
self.causes = Causes()
|
|
@@ -169,8 +175,12 @@ class BrowserControl:
|
|
|
169
175
|
if self.log is not None:
|
|
170
176
|
for tab in self.tabs.values():
|
|
171
177
|
self.log.note("tab", {"event": "closed", "id": tab["id"], "url": redact_url(tab["url"]), "by": how})
|
|
178
|
+
ended = list(self.tabs.values())
|
|
172
179
|
self.tabs.clear()
|
|
173
180
|
self._sessions.clear()
|
|
181
|
+
self._screencasts.clear()
|
|
182
|
+
for tab in ended:
|
|
183
|
+
self._heard("closed", tab)
|
|
174
184
|
self._frame_tabs.clear()
|
|
175
185
|
self._open_dialogs.clear()
|
|
176
186
|
self._choosers.clear()
|
|
@@ -266,6 +276,17 @@ class BrowserControl:
|
|
|
266
276
|
tab = self._frame_tabs.get(frame, frame) if isinstance(frame, str) else None
|
|
267
277
|
return self.tabs.get(tab, {}).get("context_id") if tab is not None else None
|
|
268
278
|
|
|
279
|
+
def context_of_tab(self, target: object) -> Optional[str]:
|
|
280
|
+
"""The context of the tab ``target``, open or closed since the record started; None for the default context's,
|
|
281
|
+
or one it hasn't seen."""
|
|
282
|
+
if (tab := self.tabs.get(target) if isinstance(target, str) else None) is not None:
|
|
283
|
+
return tab.get("context_id")
|
|
284
|
+
return next((tab.get("context_id") for tab in reversed(self.closed_tabs) if tab["id"] == target), None)
|
|
285
|
+
|
|
286
|
+
def session_of(self, target: Optional[str]) -> Optional[str]:
|
|
287
|
+
"""The session of agentenv's own on the tab ``target``, None for one it isn't attached to."""
|
|
288
|
+
return next((session for session, tab in self._sessions.items() if tab == target), None) if target else None
|
|
289
|
+
|
|
269
290
|
def label_of(self, entry: dict) -> Optional[str]:
|
|
270
291
|
"""The label of the lease a tab or download was in, None for the default context."""
|
|
271
292
|
return self.other_contexts.get(entry.get("context_id"))
|
|
@@ -731,21 +752,31 @@ class BrowserControl:
|
|
|
731
752
|
await self._refresh(target)
|
|
732
753
|
return {**({"png": png} if png is not None else {"blank": True}), "page": self._state_of(target)}
|
|
733
754
|
|
|
734
|
-
async def frame(self, target: Optional[str], load_wait_s: float
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
755
|
+
async def frame(self, target: Optional[str], load_wait_s: float, context: Optional[str] = None,
|
|
756
|
+
within: bool = False) -> tuple[str, str, Optional[str], Optional[str]]:
|
|
757
|
+
"""A frame of the tab ``target``, else, for none or one that's gone, of the active tab, with ``within`` the
|
|
758
|
+
active tab of the context ``context``, else of the default one: once its page has loaded, waiting up to
|
|
759
|
+
``load_wait_s``, a JPEG of it as it shows, within ``FRAME_CAPTURE_S``, or, with a dialog keeping it from
|
|
760
|
+
painting, the frame it last took, else its last capture, a PNG; a tab that closes while its page loads is the
|
|
761
|
+
active tab's. The image base64, its format and the tab and its URL; DeviceUnavailable with no tab open, or for
|
|
762
|
+
one that paints nothing in time."""
|
|
763
|
+
|
|
764
|
+
async def active_session() -> str:
|
|
765
|
+
if not within:
|
|
766
|
+
return await self.active_session()
|
|
767
|
+
if (found := self.session_of(await self.active_tab(context))) is None:
|
|
768
|
+
raise DeviceUnavailable("the context has no tab open")
|
|
769
|
+
return found
|
|
770
|
+
|
|
771
|
+
session = self.session_of(target)
|
|
741
772
|
if session is None:
|
|
742
|
-
session = await
|
|
773
|
+
session = await active_session()
|
|
743
774
|
target = self._sessions[session]
|
|
744
775
|
deadline = asyncio.get_running_loop().time() + load_wait_s
|
|
745
776
|
while target in self._page_loading and asyncio.get_running_loop().time() < deadline:
|
|
746
777
|
await asyncio.sleep(LOAD_POLL_S)
|
|
747
778
|
if session not in self._sessions:
|
|
748
|
-
session = await
|
|
779
|
+
session = await active_session()
|
|
749
780
|
target = self._sessions[session]
|
|
750
781
|
loop = asyncio.get_running_loop()
|
|
751
782
|
deadline = loop.time() + FRAME_CAPTURE_S
|
|
@@ -769,8 +800,7 @@ class BrowserControl:
|
|
|
769
800
|
await asyncio.sleep(FRAME_RETRY_S)
|
|
770
801
|
while session not in self._sessions:
|
|
771
802
|
try:
|
|
772
|
-
session =
|
|
773
|
-
await self.active_session())
|
|
803
|
+
session = self.session_of(target) or await active_session()
|
|
774
804
|
except DeviceUnavailable:
|
|
775
805
|
if loop.time() + FRAME_RETRY_S >= deadline:
|
|
776
806
|
raise
|
|
@@ -779,6 +809,74 @@ class BrowserControl:
|
|
|
779
809
|
self._frames[target] = shot["data"], "jpg"
|
|
780
810
|
return shot["data"], "jpg", target, self.url_of(target)
|
|
781
811
|
|
|
812
|
+
async def capture_tab(self, target: str) -> Optional[bytes]:
|
|
813
|
+
"""The tab ``target`` as it shows now, a JPEG's bytes, or with a dialog keeping it from painting the frame it
|
|
814
|
+
last took; None when it can't be had within ``FRAME_CAPTURE_S``, as for a tab that's gone or never painted. Of
|
|
815
|
+
that tab alone, as a recording of its context wants it."""
|
|
816
|
+
if (session := self.session_of(target)) is None:
|
|
817
|
+
return None
|
|
818
|
+
if session in self._open_dialogs:
|
|
819
|
+
held = self._frames.get(target)
|
|
820
|
+
return base64.b64decode(held[0]) if held is not None and held[1] == "jpg" else None
|
|
821
|
+
try:
|
|
822
|
+
shot = await self._nudged_capture(session, FRAME_CAPTURE_S)
|
|
823
|
+
except (asyncio.TimeoutError, ConnectionError, DevToolsError, _TabGone):
|
|
824
|
+
return None
|
|
825
|
+
self._frames[target] = shot["data"], "jpg"
|
|
826
|
+
return base64.b64decode(shot["data"])
|
|
827
|
+
|
|
828
|
+
async def visible(self, target: str) -> bool:
|
|
829
|
+
"""Whether the tab ``target`` shows in its window, as a tab behind another doesn't; False when it can't be told.
|
|
830
|
+
A visible tab's screencast sends a frame each time it paints, so one that sends none is still."""
|
|
831
|
+
if (session := self.session_of(target)) is None:
|
|
832
|
+
return False
|
|
833
|
+
try:
|
|
834
|
+
answer = await self.devtools.call("Runtime.evaluate", {"expression": "document.visibilityState",
|
|
835
|
+
"returnByValue": True}, session_id=session,
|
|
836
|
+
timeout_s=ACTIVE_CHECK_TIMEOUT_S)
|
|
837
|
+
return answer["result"]["value"] == "visible"
|
|
838
|
+
except (ConnectionError, DevToolsError, asyncio.TimeoutError, KeyError, TypeError):
|
|
839
|
+
return False
|
|
840
|
+
|
|
841
|
+
async def screencast(self, target: str, heard: Callable[[bytes], None], max_edge: Optional[int] = None
|
|
842
|
+
) -> Optional[str]:
|
|
843
|
+
"""``heard`` told each frame the tab ``target`` paints, a JPEG's bytes, on a screencast of agentenv's own
|
|
844
|
+
session on it, which one screencast serves for everything that follows the tab; its session, None for a tab it
|
|
845
|
+
isn't attached to or that won't screencast."""
|
|
846
|
+
if (session := self.session_of(target)) is None:
|
|
847
|
+
return None
|
|
848
|
+
hearing = self._screencasts.setdefault(session, [])
|
|
849
|
+
hearing.append(heard)
|
|
850
|
+
if len(hearing) == 1:
|
|
851
|
+
options = {**SCREENCAST, **({"maxWidth": max_edge, "maxHeight": max_edge} if max_edge else {})}
|
|
852
|
+
try:
|
|
853
|
+
await self.devtools.call("Page.startScreencast", options, session_id=session)
|
|
854
|
+
except (ConnectionError, DevToolsError, asyncio.TimeoutError):
|
|
855
|
+
self._screencasts.pop(session, None)
|
|
856
|
+
return None
|
|
857
|
+
return session
|
|
858
|
+
|
|
859
|
+
async def unscreencast(self, session: str, heard: Callable[[bytes], None]) -> None:
|
|
860
|
+
"""``heard`` no longer told the frames of the screencast on ``session``, which stops once nothing hears it."""
|
|
861
|
+
hearing = self._screencasts.get(session)
|
|
862
|
+
if hearing is None or heard not in hearing:
|
|
863
|
+
return
|
|
864
|
+
hearing.remove(heard)
|
|
865
|
+
if not hearing:
|
|
866
|
+
self._screencasts.pop(session, None)
|
|
867
|
+
with contextlib.suppress(ConnectionError, DevToolsError, asyncio.TimeoutError):
|
|
868
|
+
await self.devtools.call("Page.stopScreencast", session_id=session)
|
|
869
|
+
|
|
870
|
+
def _on_Page_screencastFrame(self, params: dict, session: Optional[str]) -> None:
|
|
871
|
+
if isinstance(ack := params.get("sessionId"), int):
|
|
872
|
+
self._spawn(self.devtools.call("Page.screencastFrameAck", {"sessionId": ack}, session_id=session))
|
|
873
|
+
try:
|
|
874
|
+
data = base64.b64decode(params.get("data") or "")
|
|
875
|
+
except ValueError:
|
|
876
|
+
return
|
|
877
|
+
for heard in list(self._screencasts.get(session, ())):
|
|
878
|
+
heard(data)
|
|
879
|
+
|
|
782
880
|
def _held_frame(self, target: str) -> tuple[str, str, Optional[str], Optional[str]]:
|
|
783
881
|
"""The frame of a tab a dialog keeps from painting: the one it last took, else its last capture, a PNG;
|
|
784
882
|
DeviceUnavailable for a tab with neither."""
|
|
@@ -895,6 +993,7 @@ class BrowserControl:
|
|
|
895
993
|
if self.log is not None:
|
|
896
994
|
self._spawn(self._log_opened(self.log.reserve(), log_time(), info["targetId"], info.get("url", ""),
|
|
897
995
|
info.get("openerId"), self._launching))
|
|
996
|
+
self._heard("opened", self.tabs[info["targetId"]])
|
|
898
997
|
|
|
899
998
|
async def _log_opened(self, seq: int, at: str, target: str, url: str, opener: Optional[str],
|
|
900
999
|
launching: bool) -> None:
|
|
@@ -996,6 +1095,7 @@ class BrowserControl:
|
|
|
996
1095
|
if self.log is not None:
|
|
997
1096
|
self.log.note("tab", {"event": "closed", "id": target, "url": redact_url(tab["url"]),
|
|
998
1097
|
**caused(self.causes.closed(target), self.log, target)})
|
|
1098
|
+
self._heard("closed", tab)
|
|
999
1099
|
else:
|
|
1000
1100
|
self.causes.closed(target)
|
|
1001
1101
|
self._closing.discard(target)
|
|
@@ -1025,6 +1125,7 @@ class BrowserControl:
|
|
|
1025
1125
|
self._pinned.setdefault(target, asyncio.Event()).set()
|
|
1026
1126
|
|
|
1027
1127
|
def _on_Target_detachedFromTarget(self, params: dict, session: Optional[str]) -> None:
|
|
1128
|
+
self._screencasts.pop(params["sessionId"], None)
|
|
1028
1129
|
if (target := self._sessions.pop(params["sessionId"], None)) is not None:
|
|
1029
1130
|
self._shots.pop(target, None)
|
|
1030
1131
|
self._frames.pop(target, None)
|
|
@@ -1103,6 +1204,13 @@ class BrowserControl:
|
|
|
1103
1204
|
finally:
|
|
1104
1205
|
download["ended_at"] = _now()
|
|
1105
1206
|
|
|
1207
|
+
def _heard(self, event: str, tab: dict) -> None:
|
|
1208
|
+
for hook in self.on_tab:
|
|
1209
|
+
try:
|
|
1210
|
+
hook(event, tab)
|
|
1211
|
+
except Exception as e:
|
|
1212
|
+
logger.warning(f"what hears of the browser's tabs: {type(e).__name__}: {e}")
|
|
1213
|
+
|
|
1106
1214
|
def _spawn(self, work: Awaitable) -> None:
|
|
1107
1215
|
task = asyncio.ensure_future(work)
|
|
1108
1216
|
self._tasks.add(task)
|
|
@@ -37,7 +37,8 @@ from .contexts import CONTEXTS, TASK, Contexts, label_problem
|
|
|
37
37
|
from .scope import Scope
|
|
38
38
|
from .control import AGENT, DOWNLOADS, EXIT, LIVE_START_TAB_TIMEOUT_S, LOADED, STOP, UPLOADS, BrowserControl, _now
|
|
39
39
|
from .devtools import PIPE_IN, PIPE_OUT, DevToolsError, DevToolsPipe
|
|
40
|
-
from .recording import BROWSER_RECORDING, MAX_DURATION_S, MAX_FRAMES,
|
|
40
|
+
from .recording import (BROWSER_RECORDING, DEFAULT_FPS, MAX_CHILDREN, MAX_DURATION_S, MAX_FPS, MAX_FRAMES,
|
|
41
|
+
MAX_OBJECTS, MAX_OPEN, MP4, BrowserRecordings, Video)
|
|
41
42
|
from .shapes import (BrowserRecord, BrowserState, ContextState, ContextToLoad, CookieToSet, OriginStorage, SiteNames,
|
|
42
43
|
StateToLoad)
|
|
43
44
|
|
|
@@ -171,8 +172,11 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
171
172
|
self.relay = Relay(self.devtools, dialogs_answered=self.settings.dialogs != AGENT, log=self.log,
|
|
172
173
|
control=self.control, contexts=self.contexts)
|
|
173
174
|
self.contexts.on_end.append(self._lease_ended)
|
|
174
|
-
#: Its recordings:
|
|
175
|
-
|
|
175
|
+
#: Its recordings, one per context: a video of the tab its agent is on, its log, the network log as HAR and,
|
|
176
|
+
#: when asked, frames, uploaded under each one's grant.
|
|
177
|
+
self.recordings = BrowserRecordings(self.log, self.control, self.contexts,
|
|
178
|
+
self.network if self.settings.network else None,
|
|
179
|
+
(self.settings.window.width, self.settings.window.height))
|
|
176
180
|
self.devtools.on_close(self._pipe_closed)
|
|
177
181
|
|
|
178
182
|
@classmethod
|
|
@@ -417,11 +421,15 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
417
421
|
return {}
|
|
418
422
|
|
|
419
423
|
@extension(BROWSER_RECORDING, op="start")
|
|
420
|
-
async def browser_recording_start(self, request_id: str, upload: dict, frames: bool =
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
async def browser_recording_start(self, request_id: str, upload: dict, frames: bool = False,
|
|
425
|
+
context: Optional[str] = None, fps: Optional[int] = None,
|
|
426
|
+
network: Optional[bool] = None, max_edge: Optional[int] = None) -> dict:
|
|
427
|
+
"""A recording of the lease ``context``, else of the default context, uploaded under the write namespace grant
|
|
428
|
+
``upload``: a video of the tab its agent is on at ``fps``, its longer edge at most ``max_edge``; its log's lines
|
|
429
|
+
of that context; with ``network``, the browser's network log as HAR, by default when it keeps one; and with
|
|
430
|
+
``frames``, a frame of that tab at the start, after each burst of its agent's actions settles and at the end.
|
|
431
|
+
A start again with the same ``request_id`` answers the recording it began."""
|
|
432
|
+
return await self.recordings.start(request_id, upload, frames, context, fps, network, max_edge)
|
|
425
433
|
|
|
426
434
|
@extension(BROWSER_RECORDING, op="end")
|
|
427
435
|
async def browser_recording_end(self, recording_id: str, upload: Optional[dict] = None,
|
|
@@ -811,7 +819,10 @@ class WebsiteBrowserEnvironment(ComputerAppEnvironment):
|
|
|
811
819
|
|
|
812
820
|
def extension_params(self, uri: str) -> dict:
|
|
813
821
|
if uri == BROWSER_RECORDING:
|
|
814
|
-
return {"max_duration_s": MAX_DURATION_S, "max_frames": MAX_FRAMES, "frames": True
|
|
822
|
+
return {"max_duration_s": MAX_DURATION_S, "max_frames": MAX_FRAMES, "frames": True,
|
|
823
|
+
"video": Video is not None, "formats": [MP4], "fps": {"default": DEFAULT_FPS, "max": MAX_FPS},
|
|
824
|
+
"context": True, "network": self.recordings.network is not None, "max_open": MAX_OPEN,
|
|
825
|
+
"max_children": MAX_CHILDREN, "max_objects": MAX_OBJECTS}
|
|
815
826
|
if uri == BROWSER:
|
|
816
827
|
params: dict[str, Any] = {"chromium": self.version, "clock": "real", "mode": _mode()}
|
|
817
828
|
if _alone():
|
|
@@ -39,6 +39,8 @@ HAR_FILE = "network.har"
|
|
|
39
39
|
#: How many lines, and how many of their bytes, one read returns at most.
|
|
40
40
|
READ_LIMIT = 500
|
|
41
41
|
READ_BYTES = 32 << 20
|
|
42
|
+
#: A line number past any line's: a read after it returns no lines, but its mark moves on to the last one written.
|
|
43
|
+
PAST_EVERY_SEQ = 1 << 62
|
|
42
44
|
#: How much of an answer's body, and of a request's, an entry keeps once decoded; decoding stops there.
|
|
43
45
|
DECODED_LIMIT, REQUEST_DECODED_LIMIT = 1 << 20, 10 << 20
|
|
44
46
|
#: A ``charset`` in a ``Content-Type``.
|
|
@@ -95,6 +97,11 @@ class NetworkLog:
|
|
|
95
97
|
async def read_async(self, after: int = 0, limit: int = READ_LIMIT) -> dict:
|
|
96
98
|
return await asyncio.to_thread(self.read, after, limit)
|
|
97
99
|
|
|
100
|
+
def last_seq(self) -> int:
|
|
101
|
+
"""The number of the last line written so far, 0 before any: read on from where the last read ended."""
|
|
102
|
+
self.read(after=PAST_EVERY_SEQ, limit=1)
|
|
103
|
+
return self._mark[0]
|
|
104
|
+
|
|
98
105
|
def every_line(self) -> list[dict]:
|
|
99
106
|
lines, after = [], 0
|
|
100
107
|
while (page := self.read(after, limit=1 << 30))["lines"]:
|