agentenv-framework-protocol 0.1.522__tar.gz → 0.1.524__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.522 → agentenv_framework_protocol-0.1.524}/PKG-INFO +30 -2
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/README.md +29 -1
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/app.py +4 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/serve_app.py +3 -2
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/tool_context.py +3 -1
- agentenv_framework_protocol-0.1.522/src/agentenv_protocol/browser_cdp.py → agentenv_framework_protocol-0.1.524/src/agentenv_protocol/website_browser/cdp.py +139 -26
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/control.py +186 -10
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/data.py +5 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/environment.py +126 -10
- agentenv_framework_protocol-0.1.524/src/agentenv_protocol/website_browser/log.py +549 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_browser_cdp.py +231 -5
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_browser_data.py +20 -2
- agentenv_framework_protocol-0.1.524/tests/test_browser_log.py +329 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_context_injection.py +6 -1
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/recording.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.522 → agentenv_framework_protocol-0.1.524}/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.524
|
|
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
|
|
@@ -1067,7 +1067,35 @@ are the profile's template. The base class adds:
|
|
|
1067
1067
|
and, completed, its size and sha256; and `dialogs`, each with its type, message, default text, answer
|
|
1068
1068
|
and who gave it.
|
|
1069
1069
|
`hidden_page()` gives agentenv a page of its own for reading state, in no window and never in the record.
|
|
1070
|
-
-
|
|
1070
|
+
- **Its log**, `self.log`, a `BrowserLog` (`agentenv_protocol.website_browser.log`): one entry for each action agents take on it
|
|
1071
|
+
and an event each time a tab opens, navigates or closes. Its server writes it, the one writer, to
|
|
1072
|
+
`/var/log/agentenv/browser-<name>.jsonl` (its own `.agentenv/` folder when that can't be written), one JSON object a
|
|
1073
|
+
line with its `seq` and `at` and one of `action`, `tab`, `outcome` or `reset`. A line's number is taken when what it
|
|
1074
|
+
records begins and the line written when it ends, so `log {after}` returns lines in order up to the last whose every
|
|
1075
|
+
earlier line is written (`last`), and `last` never moves back. An action still going after 60 s is written by the
|
|
1076
|
+
next read as `unfinished`, so it holds back nothing after it, and once it ends an `outcome` line names it (`entry`)
|
|
1077
|
+
with what it ended with. A relayed connection's commands reach the browser in the order they came. The file lasts the
|
|
1078
|
+
computer's boot, a restarted server carrying on the sequence and the
|
|
1079
|
+
browser's own reset (`data/reset`) being a line. A computer's `reset_env` boots it afresh, with a new log, so a task
|
|
1080
|
+
that needs the one before takes it first, with `snapshot_env`.
|
|
1081
|
+
- **An action** is a CDP command through the relay (`via: "cdp"`, `who` the connection's user, its `connection`
|
|
1082
|
+
number, `method`, and the tab its session is on), an op a driver makes for an agent's MCP tool call (`via: "mcp"`,
|
|
1083
|
+
`who` the caller's role, `tool`, `call`, `op`), or an acting op agentenv makes itself (`via: "agentenv"`). Each
|
|
1084
|
+
carries `tab`, `url`, `ok` and, failed, `error`, and is marked `acts` or not by its method or op
|
|
1085
|
+
(`log.acts`, `ACTING_OPS`): input, navigation, tab commands, `Runtime.evaluate` and `callFunctionOn`, DOM
|
|
1086
|
+
writes, faked responses, and viewport and cookie changes act; the rest read. An acting entry keeps its `params`
|
|
1087
|
+
(and a tool call's `args`) with what could carry a secret taken out: text typed while a password field has focus,
|
|
1088
|
+
as its length; cookie and header values; the values of URL query keys that name a credential; a request's body;
|
|
1089
|
+
and each string past 2 KB cut, with its length and sha256. A reading entry keeps none.
|
|
1090
|
+
- **A tab event** (`opened`, `navigated`, `closed`) says what caused it: `by: "command"` with the `entry`, `via` and
|
|
1091
|
+
`who` of the command that asked for it, matched exactly by the target a new tab's command answers with and the
|
|
1092
|
+
loader a navigation's does; `by: "agentenv"`; `exit` or `stop`; or `by: "page"`, with the `after` of the latest
|
|
1093
|
+
acting entry on its tab (its opener's, for a popup), for a click that follows a link, a redirect or a page script.
|
|
1094
|
+
- A driver passes an agent's tool call to the browser in the `AgentEnv-Tool-Call` header (`tool_call_header`), with
|
|
1095
|
+
the caller's `AgentEnv-Role`; the page driver sends it on every call it makes for a tool. `data/get` writes the log
|
|
1096
|
+
beside `browser-state.json` as `browser-log.jsonl`, which `data/add` passes over.
|
|
1097
|
+
- **`browser/v1`** on its card: `chromium` (its `version`), `clock: "real"` and, alone, `window`; `log {after}`
|
|
1098
|
+
(GET), framework-only, its log's lines after `after`; and
|
|
1071
1099
|
`record` (GET), framework-only, which returns that record with `launches`, the app server's log of each
|
|
1072
1100
|
launch (with its cause: `boot`, `server_restart`, `launch`, `data/add` or `data/reset`), each stop it made
|
|
1073
1101
|
and each exit it didn't, with its exit `code` or the `signal` that ended it, since the computer booted.
|
|
@@ -1000,7 +1000,35 @@ are the profile's template. The base class adds:
|
|
|
1000
1000
|
and, completed, its size and sha256; and `dialogs`, each with its type, message, default text, answer
|
|
1001
1001
|
and who gave it.
|
|
1002
1002
|
`hidden_page()` gives agentenv a page of its own for reading state, in no window and never in the record.
|
|
1003
|
-
-
|
|
1003
|
+
- **Its log**, `self.log`, a `BrowserLog` (`agentenv_protocol.website_browser.log`): one entry for each action agents take on it
|
|
1004
|
+
and an event each time a tab opens, navigates or closes. Its server writes it, the one writer, to
|
|
1005
|
+
`/var/log/agentenv/browser-<name>.jsonl` (its own `.agentenv/` folder when that can't be written), one JSON object a
|
|
1006
|
+
line with its `seq` and `at` and one of `action`, `tab`, `outcome` or `reset`. A line's number is taken when what it
|
|
1007
|
+
records begins and the line written when it ends, so `log {after}` returns lines in order up to the last whose every
|
|
1008
|
+
earlier line is written (`last`), and `last` never moves back. An action still going after 60 s is written by the
|
|
1009
|
+
next read as `unfinished`, so it holds back nothing after it, and once it ends an `outcome` line names it (`entry`)
|
|
1010
|
+
with what it ended with. A relayed connection's commands reach the browser in the order they came. The file lasts the
|
|
1011
|
+
computer's boot, a restarted server carrying on the sequence and the
|
|
1012
|
+
browser's own reset (`data/reset`) being a line. A computer's `reset_env` boots it afresh, with a new log, so a task
|
|
1013
|
+
that needs the one before takes it first, with `snapshot_env`.
|
|
1014
|
+
- **An action** is a CDP command through the relay (`via: "cdp"`, `who` the connection's user, its `connection`
|
|
1015
|
+
number, `method`, and the tab its session is on), an op a driver makes for an agent's MCP tool call (`via: "mcp"`,
|
|
1016
|
+
`who` the caller's role, `tool`, `call`, `op`), or an acting op agentenv makes itself (`via: "agentenv"`). Each
|
|
1017
|
+
carries `tab`, `url`, `ok` and, failed, `error`, and is marked `acts` or not by its method or op
|
|
1018
|
+
(`log.acts`, `ACTING_OPS`): input, navigation, tab commands, `Runtime.evaluate` and `callFunctionOn`, DOM
|
|
1019
|
+
writes, faked responses, and viewport and cookie changes act; the rest read. An acting entry keeps its `params`
|
|
1020
|
+
(and a tool call's `args`) with what could carry a secret taken out: text typed while a password field has focus,
|
|
1021
|
+
as its length; cookie and header values; the values of URL query keys that name a credential; a request's body;
|
|
1022
|
+
and each string past 2 KB cut, with its length and sha256. A reading entry keeps none.
|
|
1023
|
+
- **A tab event** (`opened`, `navigated`, `closed`) says what caused it: `by: "command"` with the `entry`, `via` and
|
|
1024
|
+
`who` of the command that asked for it, matched exactly by the target a new tab's command answers with and the
|
|
1025
|
+
loader a navigation's does; `by: "agentenv"`; `exit` or `stop`; or `by: "page"`, with the `after` of the latest
|
|
1026
|
+
acting entry on its tab (its opener's, for a popup), for a click that follows a link, a redirect or a page script.
|
|
1027
|
+
- A driver passes an agent's tool call to the browser in the `AgentEnv-Tool-Call` header (`tool_call_header`), with
|
|
1028
|
+
the caller's `AgentEnv-Role`; the page driver sends it on every call it makes for a tool. `data/get` writes the log
|
|
1029
|
+
beside `browser-state.json` as `browser-log.jsonl`, which `data/add` passes over.
|
|
1030
|
+
- **`browser/v1`** on its card: `chromium` (its `version`), `clock: "real"` and, alone, `window`; `log {after}`
|
|
1031
|
+
(GET), framework-only, its log's lines after `after`; and
|
|
1004
1032
|
`record` (GET), framework-only, which returns that record with `launches`, the app server's log of each
|
|
1005
1033
|
launch (with its cause: `boot`, `server_restart`, `launch`, `data/add` or `data/reset`), each stop it made
|
|
1006
1034
|
and each exit it didn't, with its exit `code` or the `signal` that ended it, since the computer booted.
|
|
@@ -539,6 +539,10 @@ class ComputerAppEnvironment(AgentEnvEnvironment):
|
|
|
539
539
|
async def _computer_app_ready(self) -> dict:
|
|
540
540
|
return (await self._computer_app_runtime().readiness()).model_dump()
|
|
541
541
|
|
|
542
|
+
def served_asgi(self, asgi: Any) -> Any:
|
|
543
|
+
"""The application its server serves, ``asgi`` as built from its card: a subclass may wrap it."""
|
|
544
|
+
return asgi
|
|
545
|
+
|
|
542
546
|
def _computer_app_runtime(self) -> AppRuntime:
|
|
543
547
|
if self._computer_app is None:
|
|
544
548
|
raise TypeError(f"{type(self).__qualname__}.__init__ must call super().__init__()")
|
|
@@ -61,12 +61,13 @@ def _serve(argv: list[str]) -> None:
|
|
|
61
61
|
started.cancel()
|
|
62
62
|
|
|
63
63
|
asgi.router.lifespan_context = lifespan
|
|
64
|
+
served = app.served_asgi(asgi)
|
|
64
65
|
if LOOPBACK:
|
|
65
66
|
listening, token = bind(Path.cwd())
|
|
66
|
-
server = uvicorn.Server(uvicorn.Config(guarded(
|
|
67
|
+
server = uvicorn.Server(uvicorn.Config(guarded(served, token), log_level="warning"))
|
|
67
68
|
server.run(sockets=[listening])
|
|
68
69
|
else:
|
|
69
|
-
server = uvicorn.Server(uvicorn.Config(
|
|
70
|
+
server = uvicorn.Server(uvicorn.Config(served, uds=str(SOCKET), log_level="warning"))
|
|
70
71
|
SOCKET.unlink(missing_ok=True)
|
|
71
72
|
server.run()
|
|
72
73
|
if failed:
|
|
@@ -97,6 +97,8 @@ class ToolContext:
|
|
|
97
97
|
tool: str = ""
|
|
98
98
|
arguments: Mapping[str, Any] = dataclasses.field(default_factory=lambda: types.MappingProxyType({}), hash=False)
|
|
99
99
|
call_id: str = ""
|
|
100
|
+
#: Whether the call is an MCP tool call, rather than a REST or extension call.
|
|
101
|
+
mcp: bool = False
|
|
100
102
|
|
|
101
103
|
@property
|
|
102
104
|
def role(self) -> Optional[str]:
|
|
@@ -189,7 +191,7 @@ def context_from_mcp(context: Any, tool: str, arguments: Mapping[str, Any]) -> T
|
|
|
189
191
|
request = getattr(request_context, "request", None)
|
|
190
192
|
headers = getattr(request, "headers", None) if request is not None else None
|
|
191
193
|
return ToolContext(caller=caller_from_request(extra, headers), tool=tool, arguments=_frozen(arguments),
|
|
192
|
-
call_id=uuid.uuid4().hex)
|
|
194
|
+
call_id=uuid.uuid4().hex, mcp=True)
|
|
193
195
|
|
|
194
196
|
|
|
195
197
|
def _meta_entries(meta: Any) -> Optional[Mapping[str, Any]]:
|
|
@@ -18,8 +18,11 @@ from typing import TYPE_CHECKING, Any, Literal, Optional
|
|
|
18
18
|
from starlette.requests import Request
|
|
19
19
|
from starlette.websockets import WebSocket, WebSocketDisconnect
|
|
20
20
|
|
|
21
|
+
from .log import ERROR_CHARS, KEY_FIELDS, TYPING_METHODS, BrowserLog, acts, redact_text, redacted_params
|
|
22
|
+
|
|
21
23
|
if TYPE_CHECKING:
|
|
22
|
-
from .
|
|
24
|
+
from .control import BrowserControl
|
|
25
|
+
from .devtools import DevToolsPipe
|
|
23
26
|
|
|
24
27
|
logger = logging.getLogger(__name__)
|
|
25
28
|
|
|
@@ -55,6 +58,10 @@ ABOUT_PAGES = frozenset({"about:blank", "about:srcdoc"})
|
|
|
55
58
|
GUARDED_KEPT = 100
|
|
56
59
|
#: What the record says the guard did, by its action.
|
|
57
60
|
GUARDED = {"refuse": "refused", "send": "changed", "answer": "answered", "close": "closed"}
|
|
61
|
+
#: The commands that navigate a tab without naming the loader they navigate with, whose next navigation is theirs.
|
|
62
|
+
NAVIGATES_NEXT = frozenset({"Page.reload", "Page.navigateToHistoryEntry"})
|
|
63
|
+
#: What a command's entry says when its connection ended before the browser answered it.
|
|
64
|
+
ENDED_UNANSWERED = "the connection ended before the browser answered"
|
|
58
65
|
|
|
59
66
|
|
|
60
67
|
@dataclass
|
|
@@ -192,9 +199,14 @@ class _Connection:
|
|
|
192
199
|
"""One client's WebSocket, its sessions over the pipe (its browser-level one and those it attached), its unanswered
|
|
193
200
|
commands, what waits to be sent to it, and its entry in the record."""
|
|
194
201
|
|
|
195
|
-
def __init__(self, websocket: WebSocket, user: str, session: str, record: dict) -> None:
|
|
196
|
-
self.websocket, self.user, self.session, self.record = websocket, user, session, record
|
|
202
|
+
def __init__(self, websocket: WebSocket, user: str, session: str, record: dict, number: int) -> None:
|
|
203
|
+
self.websocket, self.user, self.session, self.record, self.number = websocket, user, session, record, number
|
|
197
204
|
self.sessions = {session}
|
|
205
|
+
#: The tab each session it attached is on.
|
|
206
|
+
self.targets: dict[str, str] = {}
|
|
207
|
+
#: Held by each of its commands from when it arrives until it's sent, so they're sent in the order they came,
|
|
208
|
+
#: whatever one waits on before it's sent.
|
|
209
|
+
self.order = asyncio.Lock()
|
|
198
210
|
self.commands: set[asyncio.Future] = set()
|
|
199
211
|
self.outbox: asyncio.Queue[str | tuple[int, str]] = asyncio.Queue()
|
|
200
212
|
self.waiting_bytes = 0
|
|
@@ -205,10 +217,13 @@ class Relay:
|
|
|
205
217
|
"""Each WebSocket connection given its own browser-level session over ``devtools``, its commands sent on it past the
|
|
206
218
|
guard and the answers and events of its sessions sent back, so several clients share one browser; and a record of
|
|
207
219
|
who connected when, and what the guard did to their commands. ``dialogs_answered`` says agentenv answers the
|
|
208
|
-
browser's dialogs itself.
|
|
220
|
+
browser's dialogs itself. With a ``log``, each command is an entry in it, on the tab its session is on, and
|
|
221
|
+
``control``, agentenv's own connection, tells its tab's URL, whether a password field has focus there, and what
|
|
222
|
+
causes the tab events a command brings."""
|
|
209
223
|
|
|
210
|
-
def __init__(self, devtools: DevToolsPipe, *, dialogs_answered: bool = False
|
|
211
|
-
|
|
224
|
+
def __init__(self, devtools: DevToolsPipe, *, dialogs_answered: bool = False, log: Optional[BrowserLog] = None,
|
|
225
|
+
control: Optional[BrowserControl] = None) -> None:
|
|
226
|
+
self.devtools, self.dialogs_answered, self.log, self.control = devtools, dialogs_answered, log, control
|
|
212
227
|
self.connections: list[dict] = []
|
|
213
228
|
self._by_session: dict[str, _Connection] = {}
|
|
214
229
|
self._open: set[_Connection] = set()
|
|
@@ -222,7 +237,7 @@ class Relay:
|
|
|
222
237
|
await websocket.close(code=1013, reason=f"the browser isn't answering: {type(e).__name__}")
|
|
223
238
|
return
|
|
224
239
|
record = {"user": user, "opened_at": _now(), "guarded": []}
|
|
225
|
-
connection = _Connection(websocket, user, session, record)
|
|
240
|
+
connection = _Connection(websocket, user, session, record, len(self.connections) + 1)
|
|
226
241
|
self._by_session[session] = connection
|
|
227
242
|
self._open.add(connection)
|
|
228
243
|
self.connections.append(record)
|
|
@@ -263,25 +278,56 @@ class Relay:
|
|
|
263
278
|
method, params = message["method"], message.get("params") or {}
|
|
264
279
|
session = message.get("sessionId") or connection.session
|
|
265
280
|
verdict = guard(method, params, dialogs_answered=self.dialogs_answered)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
logged = self._begin(connection, session, method, params)
|
|
282
|
+
answer, guarded = {"error": {"code": SERVER_ERROR, "message": ENDED_UNANSWERED}}, None
|
|
283
|
+
sending: Optional[asyncio.Future] = None
|
|
284
|
+
try:
|
|
285
|
+
async with connection.order:
|
|
286
|
+
if logged is not None:
|
|
287
|
+
await logged.check_password()
|
|
288
|
+
if session not in connection.sessions:
|
|
289
|
+
verdict, answer = None, {"error": NO_SESSION}
|
|
290
|
+
elif verdict.action == "refuse":
|
|
291
|
+
answer = {"error": {"code": SERVER_ERROR,
|
|
292
|
+
"message": f"agentenv refuses {method}: {verdict.reason}"}}
|
|
293
|
+
elif verdict.action != "send":
|
|
294
|
+
answer = {"result": {}}
|
|
295
|
+
else:
|
|
296
|
+
sending = asyncio.ensure_future(self.devtools.request(method, verdict.params, session_id=session))
|
|
297
|
+
await asyncio.sleep(0)
|
|
298
|
+
if sending is not None:
|
|
299
|
+
try:
|
|
300
|
+
answer = await sending
|
|
301
|
+
except ConnectionError as e:
|
|
302
|
+
answer = {"error": {"code": SERVER_ERROR, "message": str(e)}}
|
|
303
|
+
if verdict is not None and (verdict.action != "send" or verdict.changed):
|
|
304
|
+
guarded = GUARDED[verdict.action]
|
|
305
|
+
self._guarded(connection, method, verdict)
|
|
306
|
+
reply = {"id": message.get("id"), **{key: answer[key] for key in ("result", "error") if key in answer}}
|
|
307
|
+
if message.get("sessionId"):
|
|
308
|
+
reply["sessionId"] = message["sessionId"]
|
|
309
|
+
self._put(connection, reply)
|
|
310
|
+
if verdict is not None and verdict.action == "close":
|
|
311
|
+
self._close(connection, CLOSED, dropping=False)
|
|
312
|
+
finally:
|
|
313
|
+
if sending is not None and not sending.done():
|
|
314
|
+
sending.cancel()
|
|
315
|
+
if logged is not None:
|
|
316
|
+
logged.finish(answer, guarded)
|
|
317
|
+
|
|
318
|
+
def _begin(self, connection: _Connection, session: str, method: str, params: dict) -> Optional[_Logged]:
|
|
319
|
+
"""``connection``'s command, begun in the log, if there is one, on the tab ``session`` is on, or for a browser
|
|
320
|
+
command the tab it names; what it causes made known to the control."""
|
|
321
|
+
if self.log is None:
|
|
322
|
+
return None
|
|
323
|
+
target = connection.targets.get(session) if session != connection.session else None
|
|
324
|
+
if target is None and isinstance(params.get("targetId"), str):
|
|
325
|
+
target = params["targetId"]
|
|
326
|
+
acting = acts(method)
|
|
327
|
+
url = self.control.url_of(target) if self.control is not None and target else None
|
|
328
|
+
begun = self.log.begin({"via": "cdp", "who": connection.user, "connection": connection.number,
|
|
329
|
+
"method": method, "acts": acting, "tab": target, "url": url})
|
|
330
|
+
return _Logged(self, begun, method, params, target, acting)
|
|
285
331
|
|
|
286
332
|
@staticmethod
|
|
287
333
|
def _guarded(connection: _Connection, method: str, verdict: Verdict) -> None:
|
|
@@ -297,8 +343,11 @@ class Relay:
|
|
|
297
343
|
if message.get("method") == "Target.attachedToTarget" and params.get("sessionId"):
|
|
298
344
|
connection.sessions.add(params["sessionId"])
|
|
299
345
|
self._by_session[params["sessionId"]] = connection
|
|
346
|
+
if isinstance(target := (params.get("targetInfo") or {}).get("targetId"), str):
|
|
347
|
+
connection.targets[params["sessionId"]] = target
|
|
300
348
|
elif message.get("method") == "Target.detachedFromTarget" and params.get("sessionId"):
|
|
301
349
|
connection.sessions.discard(params["sessionId"])
|
|
350
|
+
connection.targets.pop(params["sessionId"], None)
|
|
302
351
|
self._by_session.pop(params["sessionId"], None)
|
|
303
352
|
if message["sessionId"] == connection.session:
|
|
304
353
|
message = {key: value for key, value in message.items() if key != "sessionId"}
|
|
@@ -343,6 +392,70 @@ class Relay:
|
|
|
343
392
|
await connection.websocket.send_text(message)
|
|
344
393
|
|
|
345
394
|
|
|
395
|
+
class _Logged:
|
|
396
|
+
"""A relayed command's entry in the log, from when it arrives until it's answered or its connection ends: what it
|
|
397
|
+
causes made known to the control as it's sent, whether a password field has focus on its tab before it types,
|
|
398
|
+
and its answer."""
|
|
399
|
+
|
|
400
|
+
def __init__(self, relay: Relay, begun: dict, method: str, params: dict, target: Optional[str],
|
|
401
|
+
acting: bool) -> None:
|
|
402
|
+
self.relay, self.begun, self.method, self.params, self.target, self.acting = \
|
|
403
|
+
relay, begun, method, params, target, acting
|
|
404
|
+
control = relay.control
|
|
405
|
+
self._cause = cause = {"seq": begun["seq"], "via": "cdp", "who": begun["action"]["who"]}
|
|
406
|
+
self._landed: Optional[asyncio.Future] = None
|
|
407
|
+
self._checks_password = self.password = False
|
|
408
|
+
if control is None or not acting:
|
|
409
|
+
return
|
|
410
|
+
if method == "Target.createTarget":
|
|
411
|
+
self._landed = asyncio.get_running_loop().create_future()
|
|
412
|
+
control.causes.creating(self._landed, cause)
|
|
413
|
+
elif method == "Target.closeTarget" and isinstance(params.get("targetId"), str):
|
|
414
|
+
control.causes.closing(params["targetId"], cause)
|
|
415
|
+
elif method == "Page.navigate" and target:
|
|
416
|
+
self._landed = asyncio.get_running_loop().create_future()
|
|
417
|
+
control.causes.navigating(target, self._landed, cause)
|
|
418
|
+
elif method in NAVIGATES_NEXT and target:
|
|
419
|
+
control.causes.navigates_next(target, cause)
|
|
420
|
+
self._checks_password = method in TYPING_METHODS and bool(target) and any(field in params
|
|
421
|
+
for field in KEY_FIELDS)
|
|
422
|
+
#: What a command that types types is withheld until its check says no password field has focus, so one
|
|
423
|
+
#: that never gets checked, its connection gone first, keeps it withheld.
|
|
424
|
+
self.password = self._checks_password
|
|
425
|
+
|
|
426
|
+
async def check_password(self) -> None:
|
|
427
|
+
"""Before a command that types is sent: whether a password field has focus on its tab, true when that can't
|
|
428
|
+
be told."""
|
|
429
|
+
if self._checks_password:
|
|
430
|
+
self.password = await self.relay.control.password_focused(self.target)
|
|
431
|
+
|
|
432
|
+
def finish(self, answer: dict, guarded: Optional[str]) -> None:
|
|
433
|
+
"""The entry written with its answer, or with why there is none: whether it worked, why not, what the guard
|
|
434
|
+
did, and, acting, its parameters as the log keeps them; what it caused made known."""
|
|
435
|
+
result = answer.get("result") or {}
|
|
436
|
+
if self._landed is not None and not self._landed.done():
|
|
437
|
+
if "error" in answer or result.get("errorText"):
|
|
438
|
+
self._landed.cancel()
|
|
439
|
+
else:
|
|
440
|
+
self._landed.set_result(result.get("targetId") if self.method == "Target.createTarget"
|
|
441
|
+
else result.get("loaderId"))
|
|
442
|
+
fields: dict[str, Any] = {"ok": "error" not in answer}
|
|
443
|
+
if "error" in answer:
|
|
444
|
+
fields["error"] = redact_text(str((answer["error"] or {}).get("message", answer["error"])))[:ERROR_CHARS]
|
|
445
|
+
if self.method in NAVIGATES_NEXT and self.target and self.relay.control is not None:
|
|
446
|
+
self.relay.control.causes.navigated_nowhere(self.target, self._cause)
|
|
447
|
+
if guarded is not None:
|
|
448
|
+
fields["guard"] = guarded
|
|
449
|
+
if self.acting:
|
|
450
|
+
fields["params"] = redacted_params(self.method, self.params, password=self.password)
|
|
451
|
+
opened = result.get("targetId") if self.method == "Target.createTarget" else None
|
|
452
|
+
if isinstance(opened, str):
|
|
453
|
+
fields["tab"] = self.target = opened
|
|
454
|
+
if self.target and self.relay.control is not None and self.begun["action"].get("url") is None:
|
|
455
|
+
fields["url"] = self.relay.control.url_of(self.target)
|
|
456
|
+
self.relay.log.finish(self.begun, **fields)
|
|
457
|
+
|
|
458
|
+
|
|
346
459
|
def _well_formed(message: Any) -> bool:
|
|
347
460
|
"""Whether ``message`` is a command the relay can read: an object with a string ``method``, and object ``params``
|
|
348
461
|
and a string ``sessionId`` if any."""
|