agentenv-framework-protocol 0.1.549__tar.gz → 0.1.551__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.549 → agentenv_framework_protocol-0.1.551}/PKG-INFO +31 -12
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/README.md +30 -11
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/recording.py +39 -21
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/cdp.py +4 -2
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/contexts.py +14 -6
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/control.py +172 -33
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/environment.py +20 -9
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/log.py +3 -2
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/network.py +7 -0
- agentenv_framework_protocol-0.1.551/src/agentenv_protocol/website_browser/recording.py +621 -0
- agentenv_framework_protocol-0.1.551/src/agentenv_protocol/website_browser/stream.py +219 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_log.py +15 -0
- agentenv_framework_protocol-0.1.551/tests/test_browser_recording.py +826 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_browser.py +114 -5
- agentenv_framework_protocol-0.1.549/src/agentenv_protocol/website_browser/recording.py +0 -274
- agentenv_framework_protocol-0.1.549/tests/test_browser_recording.py +0 -435
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/clock.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/passthrough.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/scope.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_contexts.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_network.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_clock.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_conformance_attempts.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.549 → agentenv_framework_protocol-0.1.551}/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.551
|
|
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:
|