agentenv-framework-protocol 0.1.581__tar.gz → 0.1.583__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.581 → agentenv_framework_protocol-0.1.583}/PKG-INFO +29 -3
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/README.md +28 -2
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/__init__.py +2 -0
- agentenv_framework_protocol-0.1.583/src/agentenv_protocol/a2a_agent/control_token.py +80 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/framework.py +30 -4
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/checks.py +28 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/extensions.py +5 -1
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/recording.py +6 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_agent.py +68 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_agent_clock.py +12 -1
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_conformance_recording.py +80 -4
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_recording.py +24 -1
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/clock.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/clock.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/passthrough.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/cdp.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/contexts.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/control.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/environment.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/log.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/network.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/recording.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/scope.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/src/agentenv_protocol/website_browser/stream.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_contexts.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_log.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_network.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_recording.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_clock.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_conformance_attempts.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/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.583
|
|
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
|
|
@@ -830,7 +830,8 @@ class MyDriver(ComputerDriverEnvironment):
|
|
|
830
830
|
`{recording_id, started_at, format}`; `end {recording_id, upload?, reason?}` closes the last segment
|
|
831
831
|
and returns the manifest; `end_all {reason?}` ends every recording not yet ended, each under the
|
|
832
832
|
grant it started with, and returns `{manifests}`, as the framework does before it resets or tears a
|
|
833
|
-
computer down
|
|
833
|
+
computer down; `list` (a GET) returns `{recordings}`, each still recording as `{recording_id,
|
|
834
|
+
started_at}`. A repeated `request_id`, or a repeated `end`, answers the same. A start past
|
|
834
835
|
`max_concurrent` is refused `limit_exceeded`; `max_duration_s`, free disk under 512 MB or a stream
|
|
835
836
|
failing for 60 s end a recording by itself.
|
|
836
837
|
- **Segments.** A segment closes at `max_segment_s`, when the frame size changes or after a gap in the
|
|
@@ -868,7 +869,7 @@ driver booted with a control token is probed with it: `--token`, by default
|
|
|
868
869
|
| Level | Checks | Needs on the computer |
|
|
869
870
|
|---|---|---|
|
|
870
871
|
| `basic` | P0 ready and a screenshot; P1 the card and tool schemas; P2 native frames, regions and JPEG; P5 refusals and their codes; X the declared extensions (`computer-display`, `computer-spaces`, `computer-keyboard`, `computer-exec`, `data/get`, per-role tool access, the pointer) | nothing |
|
|
871
|
-
| `full` | `basic`, then P3 colours land where the mapping says; P4 clicks show their effect; P5 refusals change nothing; P6 typed and pressed keys arrive; P7 scrolls and drags arrive; P9 commands and `data/add` run as one unprivileged user; X pointer and keyboard input, `data/add`, and a recording's segments matching their files with no gap, a repeated `request_id` joining it and `max_concurrent` held; on a page, X the page tools: a prompt answered, a file uploaded, a reload, navigation, back and forward, and tabs | Linux, `python3` with Tk (on Wayland, with PyGObject and GTK 3 instead; on a page, `python3` and `computer-page/v1`), a 1280x800 screen or larger, `computer-exec` and `data/add` |
|
|
872
|
+
| `full` | `basic`, then P3 colours land where the mapping says; P4 clicks show their effect; P5 refusals change nothing; P6 typed and pressed keys arrive; P7 scrolls and drags arrive; P9 commands and `data/add` run as one unprivileged user; X pointer and keyboard input, `data/add`, and a recording's segments matching their files with no gap, a repeated `request_id` joining it and `max_concurrent` held, counting the recordings a driver that `list`s them has open already; on a page, X the page tools: a prompt answered, a file uploaded, a reload, navigation, back and forward, and tabs | Linux, `python3` with Tk (on Wayland, with PyGObject and GTK 3 instead; on a page, `python3` and `computer-page/v1`), a 1280x800 screen or larger, `computer-exec` and `data/add` |
|
|
872
873
|
|
|
873
874
|
At `full` the probe writes the Fixture Desk, a Tk window (`conformance/fixture.py`), and its layout
|
|
874
875
|
(`conformance/desk.py`) into `~/.agentenv-probe` with `data/add` and starts it with `computer-exec`. It aims at the boxes the
|
|
@@ -1468,6 +1469,31 @@ next `await`. A process `run()` started keeps running unless `run()` stops it,
|
|
|
1468
1469
|
so kill it before re-raising. Trajectory events it appended, including any it
|
|
1469
1470
|
appends while cleaning up, are kept, and its log ends `canceled`.
|
|
1470
1471
|
|
|
1472
|
+
#### The control token
|
|
1473
|
+
|
|
1474
|
+
agent-env deploys each agent with a token of its own in `AGENTENV_CONTROL_TOKEN`
|
|
1475
|
+
(`CONTROL_TOKEN_ENV`), and sends it on every call to the agent's extension routes
|
|
1476
|
+
in the `AgentEnv-Control-Token` header (`CONTROL_TOKEN_HEADER`;
|
|
1477
|
+
`client.control_token_headers(token)`), never in `Authorization`, which a front
|
|
1478
|
+
door may claim. When the application starts serving, under `serve()` or any ASGI
|
|
1479
|
+
server that runs its lifespan, it takes the token out of the environment, so the
|
|
1480
|
+
CLIs and tools the agent runs never inherit it, and from then on every extension
|
|
1481
|
+
operation refuses a call without it with a 401, before its body is read, and logs
|
|
1482
|
+
the refusal. `/a2a`, the card, `/health`, staging and the peer-agents MCP endpoint
|
|
1483
|
+
stay open. An agent deployed without a token, or an application that isn't served,
|
|
1484
|
+
answers anyone, as before.
|
|
1485
|
+
|
|
1486
|
+
An agent that serves its `/ext/*` routes by hand adds `ControlTokenMiddleware`
|
|
1487
|
+
(`Middleware(ControlTokenMiddleware)`), which takes the token the same way and
|
|
1488
|
+
guards every `/ext/` path but staging and the peer-agents MCP endpoint.
|
|
1489
|
+
|
|
1490
|
+
An agent installed into a running container (`install/v1`) gets its token when its
|
|
1491
|
+
declaration lists it in `optional_params` (`optional_params_host` for a host
|
|
1492
|
+
install): the installer exports it to every install command as
|
|
1493
|
+
`AGENTENV_CONTROL_TOKEN`, and the agent's install writes it where the agent's
|
|
1494
|
+
server reads its environment. An optional param is never a `{placeholder}`, so an
|
|
1495
|
+
installer that doesn't know it still installs the agent, without a token.
|
|
1496
|
+
|
|
1471
1497
|
#### Live trajectories
|
|
1472
1498
|
|
|
1473
1499
|
A runtime that sees its native events as they happen appends each complete
|
|
@@ -759,7 +759,8 @@ class MyDriver(ComputerDriverEnvironment):
|
|
|
759
759
|
`{recording_id, started_at, format}`; `end {recording_id, upload?, reason?}` closes the last segment
|
|
760
760
|
and returns the manifest; `end_all {reason?}` ends every recording not yet ended, each under the
|
|
761
761
|
grant it started with, and returns `{manifests}`, as the framework does before it resets or tears a
|
|
762
|
-
computer down
|
|
762
|
+
computer down; `list` (a GET) returns `{recordings}`, each still recording as `{recording_id,
|
|
763
|
+
started_at}`. A repeated `request_id`, or a repeated `end`, answers the same. A start past
|
|
763
764
|
`max_concurrent` is refused `limit_exceeded`; `max_duration_s`, free disk under 512 MB or a stream
|
|
764
765
|
failing for 60 s end a recording by itself.
|
|
765
766
|
- **Segments.** A segment closes at `max_segment_s`, when the frame size changes or after a gap in the
|
|
@@ -797,7 +798,7 @@ driver booted with a control token is probed with it: `--token`, by default
|
|
|
797
798
|
| Level | Checks | Needs on the computer |
|
|
798
799
|
|---|---|---|
|
|
799
800
|
| `basic` | P0 ready and a screenshot; P1 the card and tool schemas; P2 native frames, regions and JPEG; P5 refusals and their codes; X the declared extensions (`computer-display`, `computer-spaces`, `computer-keyboard`, `computer-exec`, `data/get`, per-role tool access, the pointer) | nothing |
|
|
800
|
-
| `full` | `basic`, then P3 colours land where the mapping says; P4 clicks show their effect; P5 refusals change nothing; P6 typed and pressed keys arrive; P7 scrolls and drags arrive; P9 commands and `data/add` run as one unprivileged user; X pointer and keyboard input, `data/add`, and a recording's segments matching their files with no gap, a repeated `request_id` joining it and `max_concurrent` held; on a page, X the page tools: a prompt answered, a file uploaded, a reload, navigation, back and forward, and tabs | Linux, `python3` with Tk (on Wayland, with PyGObject and GTK 3 instead; on a page, `python3` and `computer-page/v1`), a 1280x800 screen or larger, `computer-exec` and `data/add` |
|
|
801
|
+
| `full` | `basic`, then P3 colours land where the mapping says; P4 clicks show their effect; P5 refusals change nothing; P6 typed and pressed keys arrive; P7 scrolls and drags arrive; P9 commands and `data/add` run as one unprivileged user; X pointer and keyboard input, `data/add`, and a recording's segments matching their files with no gap, a repeated `request_id` joining it and `max_concurrent` held, counting the recordings a driver that `list`s them has open already; on a page, X the page tools: a prompt answered, a file uploaded, a reload, navigation, back and forward, and tabs | Linux, `python3` with Tk (on Wayland, with PyGObject and GTK 3 instead; on a page, `python3` and `computer-page/v1`), a 1280x800 screen or larger, `computer-exec` and `data/add` |
|
|
801
802
|
|
|
802
803
|
At `full` the probe writes the Fixture Desk, a Tk window (`conformance/fixture.py`), and its layout
|
|
803
804
|
(`conformance/desk.py`) into `~/.agentenv-probe` with `data/add` and starts it with `computer-exec`. It aims at the boxes the
|
|
@@ -1397,6 +1398,31 @@ next `await`. A process `run()` started keeps running unless `run()` stops it,
|
|
|
1397
1398
|
so kill it before re-raising. Trajectory events it appended, including any it
|
|
1398
1399
|
appends while cleaning up, are kept, and its log ends `canceled`.
|
|
1399
1400
|
|
|
1401
|
+
#### The control token
|
|
1402
|
+
|
|
1403
|
+
agent-env deploys each agent with a token of its own in `AGENTENV_CONTROL_TOKEN`
|
|
1404
|
+
(`CONTROL_TOKEN_ENV`), and sends it on every call to the agent's extension routes
|
|
1405
|
+
in the `AgentEnv-Control-Token` header (`CONTROL_TOKEN_HEADER`;
|
|
1406
|
+
`client.control_token_headers(token)`), never in `Authorization`, which a front
|
|
1407
|
+
door may claim. When the application starts serving, under `serve()` or any ASGI
|
|
1408
|
+
server that runs its lifespan, it takes the token out of the environment, so the
|
|
1409
|
+
CLIs and tools the agent runs never inherit it, and from then on every extension
|
|
1410
|
+
operation refuses a call without it with a 401, before its body is read, and logs
|
|
1411
|
+
the refusal. `/a2a`, the card, `/health`, staging and the peer-agents MCP endpoint
|
|
1412
|
+
stay open. An agent deployed without a token, or an application that isn't served,
|
|
1413
|
+
answers anyone, as before.
|
|
1414
|
+
|
|
1415
|
+
An agent that serves its `/ext/*` routes by hand adds `ControlTokenMiddleware`
|
|
1416
|
+
(`Middleware(ControlTokenMiddleware)`), which takes the token the same way and
|
|
1417
|
+
guards every `/ext/` path but staging and the peer-agents MCP endpoint.
|
|
1418
|
+
|
|
1419
|
+
An agent installed into a running container (`install/v1`) gets its token when its
|
|
1420
|
+
declaration lists it in `optional_params` (`optional_params_host` for a host
|
|
1421
|
+
install): the installer exports it to every install command as
|
|
1422
|
+
`AGENTENV_CONTROL_TOKEN`, and the agent's install writes it where the agent's
|
|
1423
|
+
server reads its environment. An optional param is never a `{placeholder}`, so an
|
|
1424
|
+
installer that doesn't know it still installs the agent, without a token.
|
|
1425
|
+
|
|
1400
1426
|
#### Live trajectories
|
|
1401
1427
|
|
|
1402
1428
|
A runtime that sees its native events as they happen appends each complete
|
|
@@ -88,6 +88,7 @@ from .extensions import (
|
|
|
88
88
|
extension,
|
|
89
89
|
request_fields,
|
|
90
90
|
)
|
|
91
|
+
from .control_token import ControlTokenMiddleware
|
|
91
92
|
from .framework import (
|
|
92
93
|
A2AAgentApplication,
|
|
93
94
|
AgentEnvAgent,
|
|
@@ -155,6 +156,7 @@ __all__ = [
|
|
|
155
156
|
"TRIGGERS_V1",
|
|
156
157
|
"CLOCK_V1",
|
|
157
158
|
"A2AAgentApplication",
|
|
159
|
+
"ControlTokenMiddleware",
|
|
158
160
|
"AgentCapabilities",
|
|
159
161
|
"AgentConfig",
|
|
160
162
|
"AgentEnvAgent",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""The agent's control token: agent-env hands each deployed agent one (``CONTROL_TOKEN_ENV``), and the agent's
|
|
2
|
+
extension routes refuse a call that doesn't carry it in ``CONTROL_TOKEN_HEADER``. An agent with no token configured
|
|
3
|
+
serves them to anyone, as before."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import hmac
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
from collections.abc import Mapping
|
|
11
|
+
|
|
12
|
+
from starlette.datastructures import Headers
|
|
13
|
+
from starlette.responses import JSONResponse
|
|
14
|
+
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
15
|
+
|
|
16
|
+
from ..types import CONTROL_TOKEN_ENV, CONTROL_TOKEN_HEADER
|
|
17
|
+
from .peer_agents import PEER_MCP_PATH
|
|
18
|
+
from .staging import STAGING_ENDPOINT
|
|
19
|
+
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
REFUSAL = f"this route takes the agent's control token in the {CONTROL_TOKEN_HEADER} header"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def take_control_token() -> str | None:
|
|
26
|
+
"""The token agent-env handed the agent, taken out of the environment so the tools and CLIs the agent runs never
|
|
27
|
+
inherit it."""
|
|
28
|
+
return os.environ.pop(CONTROL_TOKEN_ENV, None) or None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def carries_control_token(headers: Mapping[str, str], token: str | None) -> bool:
|
|
32
|
+
"""Whether a call's ``headers`` carry ``token``; with no token, any do."""
|
|
33
|
+
if token is None:
|
|
34
|
+
return True
|
|
35
|
+
return hmac.compare_digest(headers.get(CONTROL_TOKEN_HEADER, "").encode(), token.encode())
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def log_guard(token: str | None) -> None:
|
|
39
|
+
"""Say, as serving starts, whether the extension routes take a token: an agent deployed without one serves them
|
|
40
|
+
open, which is otherwise silent."""
|
|
41
|
+
if token is None:
|
|
42
|
+
logger.info("no %s: the extension routes are open", CONTROL_TOKEN_ENV)
|
|
43
|
+
else:
|
|
44
|
+
logger.info("the extension routes take the agent's control token (%s)", CONTROL_TOKEN_HEADER)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def log_refusal(method: str, path: str, client: str | None) -> None:
|
|
48
|
+
logger.warning("refused %s %s from %s: no valid %s", method, path, client or "unknown", CONTROL_TOKEN_HEADER)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ControlTokenMiddleware:
|
|
52
|
+
"""The SDK's check for an agent that serves its ``/ext/*`` routes by hand: each one but staging and the peer-agents
|
|
53
|
+
MCP endpoint refuses a call without the agent's token with a 401. The token is taken out of the environment when
|
|
54
|
+
the application builds its middleware, as it starts serving, unless one is given."""
|
|
55
|
+
|
|
56
|
+
def __init__(self, app: ASGIApp, *, token: str | None = None) -> None:
|
|
57
|
+
self.app = app
|
|
58
|
+
self.token = token or take_control_token()
|
|
59
|
+
log_guard(self.token)
|
|
60
|
+
|
|
61
|
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
62
|
+
if scope["type"] == "http" and _guarded(_route_path(scope)):
|
|
63
|
+
if not carries_control_token(Headers(scope=scope), self.token):
|
|
64
|
+
client = scope.get("client")
|
|
65
|
+
log_refusal(scope.get("method", ""), scope["path"], client[0] if client else None)
|
|
66
|
+
await JSONResponse({"detail": REFUSAL}, status_code=401)(scope, receive, send)
|
|
67
|
+
return
|
|
68
|
+
await self.app(scope, receive, send)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _route_path(scope: Scope) -> str:
|
|
72
|
+
"""The path the app's routes match, without the prefix it is mounted under, as Starlette's router reads it."""
|
|
73
|
+
path, root = scope["path"], scope.get("root_path", "")
|
|
74
|
+
return path[len(root):] if root and path.startswith(root) else path
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _guarded(path: str) -> bool:
|
|
78
|
+
return path.startswith("/ext/") and not any(
|
|
79
|
+
path == open_path or path.startswith(open_path + "/") for open_path in (STAGING_ENDPOINT, PEER_MCP_PATH)
|
|
80
|
+
)
|
|
@@ -64,6 +64,7 @@ from .extensions import (
|
|
|
64
64
|
)
|
|
65
65
|
from ..computer.errors import ComputerError
|
|
66
66
|
from . import clock as agent_clock
|
|
67
|
+
from .control_token import REFUSAL, carries_control_token, log_guard, log_refusal, take_control_token
|
|
67
68
|
from .peer_agents import PEER_MCP_PATH, PEER_MCP_SERVER_NAME, PeerAgents
|
|
68
69
|
from .registry import RegisteredOperation, build_registry
|
|
69
70
|
from .staging import STAGING_ENDPOINT, StagingStore, staging_routes
|
|
@@ -978,6 +979,26 @@ def _serving_peer_tools(
|
|
|
978
979
|
return lifespan
|
|
979
980
|
|
|
980
981
|
|
|
982
|
+
def _taking_the_control_token(
|
|
983
|
+
application: "A2AAgentApplication",
|
|
984
|
+
inner: Callable[[Starlette], AbstractAsyncContextManager] | None,
|
|
985
|
+
) -> Callable[[Starlette], AbstractAsyncContextManager]:
|
|
986
|
+
"""The application's lifespan, ``inner``'s if it has one: serving starts by taking the agent's control token out of
|
|
987
|
+
the environment, and the extension routes take it from then on. An application that isn't served stays open."""
|
|
988
|
+
|
|
989
|
+
@asynccontextmanager
|
|
990
|
+
async def lifespan(app: Starlette) -> AsyncIterator[Any]:
|
|
991
|
+
application.control_token = take_control_token() or application.control_token
|
|
992
|
+
log_guard(application.control_token)
|
|
993
|
+
if inner is None:
|
|
994
|
+
yield None
|
|
995
|
+
else:
|
|
996
|
+
async with inner(app) as state:
|
|
997
|
+
yield state
|
|
998
|
+
|
|
999
|
+
return lifespan
|
|
1000
|
+
|
|
1001
|
+
|
|
981
1002
|
class A2AAgentApplication:
|
|
982
1003
|
"""Resolved Agent Card, extension routes, and A2A task executor."""
|
|
983
1004
|
|
|
@@ -1088,10 +1109,12 @@ class A2AAgentApplication:
|
|
|
1088
1109
|
if self.services.peers is not None:
|
|
1089
1110
|
routes.append(Route(PEER_MCP_PATH, self.services.peers.app))
|
|
1090
1111
|
lifespan = _serving_peer_tools(self.services.peers, lifespan)
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1112
|
+
self.control_token: str | None = None
|
|
1113
|
+
self.app = Starlette(
|
|
1114
|
+
routes=routes,
|
|
1115
|
+
middleware=[Middleware(_ServingOnItsPort)],
|
|
1116
|
+
lifespan=_taking_the_control_token(self, lifespan),
|
|
1117
|
+
)
|
|
1095
1118
|
|
|
1096
1119
|
try:
|
|
1097
1120
|
from a2a.server.apps import A2AStarletteApplication
|
|
@@ -1158,6 +1181,9 @@ class A2AAgentApplication:
|
|
|
1158
1181
|
self, extension_uri: str, operation: RegisteredOperation
|
|
1159
1182
|
) -> Callable:
|
|
1160
1183
|
async def invoke(request: Request) -> JSONResponse:
|
|
1184
|
+
if not carries_control_token(request.headers, self.control_token):
|
|
1185
|
+
log_refusal(request.method, request.url.path, request.client.host if request.client else None)
|
|
1186
|
+
return JSONResponse({"detail": REFUSAL}, status_code=401)
|
|
1161
1187
|
try:
|
|
1162
1188
|
if operation.definition.method == "GET":
|
|
1163
1189
|
payload = dict(request.query_params)
|
|
@@ -68,6 +68,9 @@ RECORD_S = 2.0
|
|
|
68
68
|
#: sees its motion as one event, and keys sent while the click that focuses a box waits go wherever focus was.
|
|
69
69
|
BUSY_DESK_ATTEMPTS = 2
|
|
70
70
|
RECORD_FPS = 5
|
|
71
|
+
#: How many starts per slot of ``max_concurrent`` the limit check tries before it gives up on a computer whose other
|
|
72
|
+
#: recordings keep starting and ending under it.
|
|
73
|
+
LIMIT_STARTS = 3
|
|
71
74
|
#: Prints a file's size and SHA-256 as JSON, run with ``python3 -c`` on the computer.
|
|
72
75
|
READ_DIGEST = ("import hashlib,json,sys;d=open(sys.argv[1],'rb').read();"
|
|
73
76
|
"print(json.dumps({'size':len(d),'sha256':hashlib.sha256(d).hexdigest()}))")
|
|
@@ -1037,10 +1040,35 @@ class Probe:
|
|
|
1037
1040
|
async def joined() -> str | None:
|
|
1038
1041
|
return None if state.get("joined") else "a repeated request_id started a second recording"
|
|
1039
1042
|
|
|
1043
|
+
async def recording_now() -> int:
|
|
1044
|
+
return len((await self.driver.invoke(COMPUTER_RECORDING, "list"))["recordings"])
|
|
1045
|
+
|
|
1046
|
+
async def limited_counting(most: int) -> str | None:
|
|
1047
|
+
"""Below ``most`` open recordings a start succeeds, and at ``most`` it's refused, counting every recording the
|
|
1048
|
+
driver lists. Others may start or end between a listing and a start, so a surprise is judged by a fresh one."""
|
|
1049
|
+
tries = LIMIT_STARTS * (most + 1)
|
|
1050
|
+
for _ in range(tries):
|
|
1051
|
+
before = await recording_now()
|
|
1052
|
+
try:
|
|
1053
|
+
started = await start(f"{PROBE_ROLE}-limit-{uuid.uuid4().hex[:8]}")
|
|
1054
|
+
except ExtensionCallError as e:
|
|
1055
|
+
if e.code != "limit_exceeded":
|
|
1056
|
+
return f"refused {e.code!r}, not 'limit_exceeded': {e.detail}"
|
|
1057
|
+
if before >= most or (now := await recording_now()) >= most:
|
|
1058
|
+
return None
|
|
1059
|
+
return f"refused limit_exceeded with {now} recordings open, of at most {most}"
|
|
1060
|
+
if before >= most and (now := await recording_now()) > most:
|
|
1061
|
+
return f"recording {now} of at most {most} started: {started['recording_id']}"
|
|
1062
|
+
return f"the computer's recordings kept changing over {tries} starts"
|
|
1063
|
+
|
|
1040
1064
|
async def limited() -> str | None:
|
|
1065
|
+
"""A start past ``max_concurrent`` is refused. A driver that lists its recordings is checked with them all
|
|
1066
|
+
counted; one that doesn't, after the probe's own ``max_concurrent``, as before it could."""
|
|
1041
1067
|
most = params.get("max_concurrent")
|
|
1042
1068
|
if not isinstance(most, int):
|
|
1043
1069
|
return "the card declares no max_concurrent"
|
|
1070
|
+
if "list" in (params.get("methods") or {}):
|
|
1071
|
+
return await limited_counting(most)
|
|
1044
1072
|
for _ in range(most):
|
|
1045
1073
|
await start(f"{PROBE_ROLE}-limit-{uuid.uuid4().hex[:8]}")
|
|
1046
1074
|
try:
|
|
@@ -130,7 +130,7 @@ class Extensions:
|
|
|
130
130
|
@extension(COMPUTER_RECORDING, op="start",
|
|
131
131
|
description="Record the display: start returns a recording whose segments upload through its grant as "
|
|
132
132
|
"they close; end seals it and returns its manifest, uploaded beside them; end_all ends "
|
|
133
|
-
"every one not yet ended; repeats answer the same.")
|
|
133
|
+
"every one not yet ended; list names those still recording; repeats answer the same.")
|
|
134
134
|
async def _computer_recording_start(self, request_id: str, scope: str = "display", window: Optional[str] = None,
|
|
135
135
|
fps: Optional[int] = None, max_edge: Optional[int] = None, cursor: bool = True,
|
|
136
136
|
upload: Optional[dict] = None) -> dict:
|
|
@@ -145,6 +145,10 @@ class Extensions:
|
|
|
145
145
|
async def _computer_recording_end_all(self, reason: str = "end") -> dict:
|
|
146
146
|
return {"manifests": await self._computer.recordings.end_all(reason)}
|
|
147
147
|
|
|
148
|
+
@extension(COMPUTER_RECORDING, op="list", method="GET")
|
|
149
|
+
async def _computer_recording_list(self) -> dict:
|
|
150
|
+
return {"recordings": await self._computer.recordings.listed()}
|
|
151
|
+
|
|
148
152
|
|
|
149
153
|
async def _run(computer: ComputerRuntime, cap: int, argv: list, cwd: Optional[str], env: Optional[dict],
|
|
150
154
|
timeout: float) -> dict:
|
|
@@ -197,6 +197,12 @@ class Recordings:
|
|
|
197
197
|
self.ended.popitem(last=False)
|
|
198
198
|
return manifest
|
|
199
199
|
|
|
200
|
+
async def listed(self) -> list[dict]:
|
|
201
|
+
"""Each recording still recording, by id and start time: the ones counted against ``max_concurrent``."""
|
|
202
|
+
async with self._lock:
|
|
203
|
+
return [{"recording_id": rid, "started_at": _iso(r.requested_at)}
|
|
204
|
+
for rid, r in self.running.items() if not r.done]
|
|
205
|
+
|
|
200
206
|
async def end_all(self, reason: str) -> list[dict]:
|
|
201
207
|
"""End every recording not yet ended, each uploading under the grant it was started with; their manifests."""
|
|
202
208
|
return [await self.end(recording_id, None, reason) for recording_id in list(self.running)]
|
{agentenv_framework_protocol-0.1.581 → agentenv_framework_protocol-0.1.583}/tests/test_a2a_agent.py
RENAMED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import inspect
|
|
5
5
|
import json
|
|
6
|
+
import os
|
|
6
7
|
import time
|
|
7
8
|
from dataclasses import FrozenInstanceError
|
|
8
9
|
from functools import wraps
|
|
@@ -44,6 +45,7 @@ from agentenv_protocol.a2a_agent import (
|
|
|
44
45
|
AgentEnvAgent,
|
|
45
46
|
AgentIdentity,
|
|
46
47
|
AttributionProbeResponse,
|
|
48
|
+
ControlTokenMiddleware,
|
|
47
49
|
BuiltinTools,
|
|
48
50
|
BundleSkillRequest,
|
|
49
51
|
ContextObjectTrajectoryRequest,
|
|
@@ -99,7 +101,12 @@ from agentenv_protocol.a2a_agent.framework import (
|
|
|
99
101
|
_SdkServices,
|
|
100
102
|
_StandardExecutor,
|
|
101
103
|
)
|
|
104
|
+
from agentenv_protocol import CONTROL_TOKEN_ENV, client as protocol_client
|
|
102
105
|
from pydantic import BaseModel, Field, ValidationError, field_serializer
|
|
106
|
+
from starlette.applications import Starlette
|
|
107
|
+
from starlette.middleware import Middleware
|
|
108
|
+
from starlette.responses import PlainTextResponse
|
|
109
|
+
from starlette.routing import Mount, Route
|
|
103
110
|
from starlette.testclient import TestClient
|
|
104
111
|
|
|
105
112
|
|
|
@@ -3024,3 +3031,64 @@ def test_cancel_stops_a_running_task_and_frees_its_context() -> None:
|
|
|
3024
3031
|
|
|
3025
3032
|
assert cancelled == ["hang"]
|
|
3026
3033
|
assert ran == ["hang", "next"]
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
@a2a_agent(identity=AgentIdentity(name="guarded", description="test", version="1"), extensions=(MCP_CONFIG_V1,))
|
|
3037
|
+
class _GuardedAgent(AgentEnvAgent):
|
|
3038
|
+
async def run(self, request: TaskRequest) -> TaskResult:
|
|
3039
|
+
return TaskResult.text("ok")
|
|
3040
|
+
|
|
3041
|
+
|
|
3042
|
+
def test_a_served_agent_takes_its_control_token_out_of_the_environment_and_its_routes_refuse_calls_without_it(
|
|
3043
|
+
monkeypatch, caplog,
|
|
3044
|
+
) -> None:
|
|
3045
|
+
monkeypatch.setenv(CONTROL_TOKEN_ENV, "s3cret")
|
|
3046
|
+
|
|
3047
|
+
with caplog.at_level("INFO", logger="agentenv_protocol.a2a_agent.control_token"), \
|
|
3048
|
+
TestClient(_GuardedAgent().create_app()) as agent:
|
|
3049
|
+
left_in_environment = CONTROL_TOKEN_ENV in os.environ
|
|
3050
|
+
refused = [
|
|
3051
|
+
agent.get("/ext/mcp-config", headers=headers).status_code
|
|
3052
|
+
for headers in ({}, protocol_client.control_token_headers("guess"), {"Authorization": "Bearer s3cret"})
|
|
3053
|
+
]
|
|
3054
|
+
detail = agent.get("/ext/mcp-config").json()["detail"]
|
|
3055
|
+
answered = agent.get("/ext/mcp-config", headers=protocol_client.control_token_headers("s3cret"))
|
|
3056
|
+
still_open = [agent.get(path).status_code for path in ("/health", "/.well-known/agent.json")]
|
|
3057
|
+
|
|
3058
|
+
assert not left_in_environment and "the extension routes take the agent's control token" in caplog.text
|
|
3059
|
+
assert "s3cret" not in caplog.text
|
|
3060
|
+
assert refused == [401, 401, 401] and "AgentEnv-Control-Token" in detail
|
|
3061
|
+
assert answered.status_code == 200 and answered.json() == {"mcp_servers": {}}
|
|
3062
|
+
assert still_open == [200, 200]
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
def test_an_agent_with_no_token_or_not_served_keeps_its_routes_open(monkeypatch, caplog) -> None:
|
|
3066
|
+
monkeypatch.setenv(CONTROL_TOKEN_ENV, "s3cret")
|
|
3067
|
+
unserved = TestClient(_GuardedAgent().create_app()).get("/ext/mcp-config").status_code
|
|
3068
|
+
monkeypatch.delenv(CONTROL_TOKEN_ENV)
|
|
3069
|
+
|
|
3070
|
+
with caplog.at_level("INFO", logger="agentenv_protocol.a2a_agent.control_token"), \
|
|
3071
|
+
TestClient(_GuardedAgent().create_app()) as agent:
|
|
3072
|
+
tokenless = agent.get("/ext/mcp-config").status_code
|
|
3073
|
+
|
|
3074
|
+
assert unserved == tokenless == 200
|
|
3075
|
+
assert f"no {CONTROL_TOKEN_ENV}: the extension routes are open" in caplog.text
|
|
3076
|
+
|
|
3077
|
+
|
|
3078
|
+
def test_the_middleware_guards_a_hand_served_agents_extension_routes_where_its_app_is_mounted_but_staging_and_the_peer_tools(
|
|
3079
|
+
monkeypatch,
|
|
3080
|
+
) -> None:
|
|
3081
|
+
monkeypatch.setenv(CONTROL_TOKEN_ENV, "s3cret")
|
|
3082
|
+
|
|
3083
|
+
async def ok(request):
|
|
3084
|
+
return PlainTextResponse("ok")
|
|
3085
|
+
|
|
3086
|
+
paths = ("/ext/agent-config", "/ext/staging/abc", "/ext/peer-agents/mcp", "/health")
|
|
3087
|
+
agent_app = Starlette(routes=[Route(path, ok) for path in paths], middleware=[Middleware(ControlTokenMiddleware)])
|
|
3088
|
+
with TestClient(Starlette(routes=[Mount("/agent", agent_app)])) as agent:
|
|
3089
|
+
without = [agent.get(f"/agent{path}").status_code for path in paths]
|
|
3090
|
+
with_token = agent.get("/agent/ext/agent-config", headers=protocol_client.control_token_headers("s3cret"))
|
|
3091
|
+
left_in_environment = CONTROL_TOKEN_ENV in os.environ
|
|
3092
|
+
|
|
3093
|
+
assert without == [401, 200, 200, 200]
|
|
3094
|
+
assert with_token.status_code == 200 and not left_in_environment
|
|
@@ -45,6 +45,17 @@ def _status(image, **status) -> None:
|
|
|
45
45
|
(image / "status.json").write_text(json.dumps(status))
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
EARLIER_STATUS_AGE_NS = 1_000_000_000
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _status_from_before(image, **status) -> None:
|
|
52
|
+
"""A status the follower wrote for an earlier config, ``EARLIER_STATUS_AGE_NS`` before this one: a file's mtime on
|
|
53
|
+
Linux moves in ticks of a few milliseconds, so a config written right after a status can share its mtime."""
|
|
54
|
+
_status(image, **status)
|
|
55
|
+
before = time.time_ns() - EARLIER_STATUS_AGE_NS
|
|
56
|
+
os.utime(image / "status.json", ns=(before, before))
|
|
57
|
+
|
|
58
|
+
|
|
48
59
|
def _follows_the_next_config(image, **status) -> threading.Thread:
|
|
49
60
|
"""A follower that, as the real one, writes its status once it reads a config other than the one it had."""
|
|
50
61
|
config = image / "follower.json"
|
|
@@ -140,7 +151,7 @@ def test_a_zone_that_isnt_one_is_refused(image):
|
|
|
140
151
|
{"url": "http://gw/clock/watch", "name": "agent-solver"}, # this one, under the token the config replaced
|
|
141
152
|
])
|
|
142
153
|
def test_what_the_follower_showed_of_its_config_before_never_passes_for_the_new_one(image, before):
|
|
143
|
-
|
|
154
|
+
_status_from_before(image, connected=True, version="b:3", armed=True, **before)
|
|
144
155
|
with _app() as client:
|
|
145
156
|
answer = client.post("/ext/clock/sync-time", json=REQUEST)
|
|
146
157
|
|
|
@@ -15,7 +15,7 @@ pytest.importorskip("av")
|
|
|
15
15
|
|
|
16
16
|
from probe_fake import FixtureDriver, served # noqa: E402
|
|
17
17
|
|
|
18
|
-
from agentenv_protocol.computer import RecordedFrame, Recording, capture, record # noqa: E402
|
|
18
|
+
from agentenv_protocol.computer import COMPUTER_RECORDING, RecordedFrame, Recording, capture, record # noqa: E402
|
|
19
19
|
from agentenv_protocol.computer import recording as recording_module # noqa: E402
|
|
20
20
|
from agentenv_protocol.computer.conformance import checks, run_probe # noqa: E402
|
|
21
21
|
from agentenv_protocol.computer.conformance.client import Driver # noqa: E402
|
|
@@ -45,6 +45,12 @@ async def _recording_checks(driver) -> dict[str, tuple[str, str]]:
|
|
|
45
45
|
return {r.name: (r.status, r.detail) for r in probe.results}
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def _advertising(monkeypatch, most: int) -> None:
|
|
49
|
+
advertised = recording_module.recording_params
|
|
50
|
+
monkeypatch.setattr("agentenv_protocol.computer.card.recording_params",
|
|
51
|
+
lambda features, streams: {**advertised(features, streams), "max_concurrent": most})
|
|
52
|
+
|
|
53
|
+
|
|
48
54
|
@pytest.mark.asyncio
|
|
49
55
|
async def test_a_driver_that_records_passes_the_recording_checks_at_full_and_leaves_nothing(home):
|
|
50
56
|
with served(Recorder()) as url:
|
|
@@ -68,9 +74,7 @@ async def test_a_manifest_whose_hash_or_size_isnt_the_files_fails(home, monkeypa
|
|
|
68
74
|
|
|
69
75
|
@pytest.mark.asyncio
|
|
70
76
|
async def test_a_limit_the_driver_doesnt_keep_fails_and_its_recordings_are_still_ended(home, monkeypatch):
|
|
71
|
-
|
|
72
|
-
monkeypatch.setattr("agentenv_protocol.computer.card.recording_params",
|
|
73
|
-
lambda features, streams: {**advertised(features, streams), "max_concurrent": 1})
|
|
77
|
+
_advertising(monkeypatch, 1)
|
|
74
78
|
driver = Recorder()
|
|
75
79
|
found = await _recording_checks(driver)
|
|
76
80
|
assert found[NAMES[2]][0] == "failed" and "recording 2 of at most 1 started" in found[NAMES[2]][1]
|
|
@@ -78,6 +82,78 @@ async def test_a_limit_the_driver_doesnt_keep_fails_and_its_recordings_are_still
|
|
|
78
82
|
assert not driver._computer.recordings.running and not (home / ".agentenv-recordings").exists()
|
|
79
83
|
|
|
80
84
|
|
|
85
|
+
async def _checks_while_recording(driver) -> tuple[dict[str, tuple[str, str]], str, list[str]]:
|
|
86
|
+
"""The recording checks on a computer recording already, as a task's that records while it probes: what they
|
|
87
|
+
found, the task's recording, and what was still recording once they were done."""
|
|
88
|
+
with served(driver) as url:
|
|
89
|
+
connected = await Driver.connect(url, 10)
|
|
90
|
+
async with connected.session() as session:
|
|
91
|
+
theirs = (await connected.invoke(COMPUTER_RECORDING, "start", {"request_id": "task"}))["recording_id"]
|
|
92
|
+
probe = checks.Probe(connected, session, 10)
|
|
93
|
+
await probe._recording()
|
|
94
|
+
listed = await connected.invoke(COMPUTER_RECORDING, "list")
|
|
95
|
+
await connected.invoke(COMPUTER_RECORDING, "end", {"recording_id": theirs})
|
|
96
|
+
return {r.name: (r.status, r.detail) for r in probe.results}, theirs, [r["recording_id"] for r in listed["recordings"]]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@pytest.mark.asyncio
|
|
100
|
+
async def test_a_computer_already_recording_passes_the_recording_checks_and_keeps_its_recording(home):
|
|
101
|
+
"""The probe counts the recording it didn't start against max_concurrent, and ends only its own."""
|
|
102
|
+
found, theirs, still = await _checks_while_recording(Recorder())
|
|
103
|
+
assert {name: status for name, (status, _) in found.items()} == dict.fromkeys(NAMES, "passed")
|
|
104
|
+
assert still == [theirs]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@pytest.mark.asyncio
|
|
108
|
+
@pytest.mark.parametrize("recording_already", [False, True], ids=["idle", "recording"])
|
|
109
|
+
async def test_a_driver_that_refuses_short_of_the_limit_its_card_declares_fails(home, monkeypatch, recording_already):
|
|
110
|
+
class Short(FixtureDriver):
|
|
111
|
+
recording = Recording(max_concurrent=2)
|
|
112
|
+
|
|
113
|
+
_advertising(monkeypatch, 3)
|
|
114
|
+
found = (await _checks_while_recording(Short()))[0] if recording_already else await _recording_checks(Short())
|
|
115
|
+
assert found[NAMES[2]][0] == "failed" and "limit_exceeded" in found[NAMES[2]][1]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@pytest.mark.asyncio
|
|
119
|
+
@pytest.mark.parametrize("meanwhile", ["ends", "starts"])
|
|
120
|
+
async def test_a_recording_that_ends_or_starts_between_the_probes_count_and_its_start_doesnt_fail_it(home, monkeypatch,
|
|
121
|
+
meanwhile):
|
|
122
|
+
"""The task's recording ending just before the probe's second limit start, or another starting just before its
|
|
123
|
+
first: a listing after the start says the limit held."""
|
|
124
|
+
real, limit_starts = recording_module.Recordings.start, []
|
|
125
|
+
|
|
126
|
+
async def start(self, request_id, *args):
|
|
127
|
+
if "-limit-" in request_id:
|
|
128
|
+
limit_starts.append(request_id)
|
|
129
|
+
if meanwhile == "ends" and len(limit_starts) == 2:
|
|
130
|
+
await self.end(self.started["task"]["recording_id"], None, "end")
|
|
131
|
+
if meanwhile == "starts" and len(limit_starts) == 1:
|
|
132
|
+
await real(self, "late", *args)
|
|
133
|
+
return await real(self, request_id, *args)
|
|
134
|
+
|
|
135
|
+
monkeypatch.setattr(recording_module.Recordings, "start", start)
|
|
136
|
+
driver = Recorder()
|
|
137
|
+
found, theirs, still = await _checks_while_recording(driver)
|
|
138
|
+
late = driver._computer.recordings.started.get("late")
|
|
139
|
+
if late:
|
|
140
|
+
await driver._computer.recordings.end(late["recording_id"], None, "end")
|
|
141
|
+
assert found[NAMES[2]] == ("passed", ""), found[NAMES[2]]
|
|
142
|
+
assert still == ([] if meanwhile == "ends" else [theirs, late["recording_id"]])
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@pytest.mark.asyncio
|
|
146
|
+
async def test_from_a_driver_that_doesnt_list_its_recordings_the_probe_starts_the_whole_limit_as_before(home, monkeypatch):
|
|
147
|
+
"""So a computer that's recording already fails the limit check, as it did before drivers listed them."""
|
|
148
|
+
params = Driver.params
|
|
149
|
+
monkeypatch.setattr(Driver, "params", lambda self, uri: {**params(self, uri), "methods": {
|
|
150
|
+
op: m for op, m in (params(self, uri).get("methods") or {}).items() if op != "list"}})
|
|
151
|
+
idle = await _recording_checks(Recorder())
|
|
152
|
+
recording, _, _ = await _checks_while_recording(Recorder())
|
|
153
|
+
assert idle[NAMES[2]][0] == "passed"
|
|
154
|
+
assert recording[NAMES[2]][0] == "failed" and "limit_exceeded" in recording[NAMES[2]][1]
|
|
155
|
+
|
|
156
|
+
|
|
81
157
|
@pytest.mark.asyncio
|
|
82
158
|
async def test_a_driver_that_turns_recording_off_gets_no_recording_checks(home):
|
|
83
159
|
class Off(FixtureDriver):
|
|
@@ -31,9 +31,11 @@ from agentenv_protocol.computer import ( # noqa: E402
|
|
|
31
31
|
)
|
|
32
32
|
from agentenv_protocol.computer import recording as recording_module # noqa: E402
|
|
33
33
|
from agentenv_protocol.transfers import TransferError # noqa: E402
|
|
34
|
+
from agentenv_protocol.types import CONTROL_TOKEN_ENV # noqa: E402
|
|
34
35
|
|
|
35
36
|
START, END = "/agentenv/ext/computer-recording/start", "/agentenv/ext/computer-recording/end"
|
|
36
37
|
END_ALL = "/agentenv/ext/computer-recording/end_all"
|
|
38
|
+
LIST = "/agentenv/ext/computer-recording/list"
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
@pytest.fixture(autouse=True)
|
|
@@ -135,7 +137,7 @@ async def test_every_driver_serves_recording_unless_it_turns_it_off():
|
|
|
135
137
|
async with http_client(Off()) as http:
|
|
136
138
|
off = (await http.get("/.well-known/agent-env.json")).json()
|
|
137
139
|
extension = next(e for e in card["capabilities"]["extensions"] if e["uri"] == COMPUTER_RECORDING)
|
|
138
|
-
assert set(extension["params"]["methods"]) == {"start", "end", "end_all"}
|
|
140
|
+
assert set(extension["params"]["methods"]) == {"start", "end", "end_all", "list"}
|
|
139
141
|
assert {k: v for k, v in extension["params"].items() if k not in ("methods", "endpoint")} == {
|
|
140
142
|
"formats": ["video/mp4; codecs=avc1"], "scopes": ["display"], "fps": {"default": 10, "max": 15},
|
|
141
143
|
"cursor": True, "source": "capture", "max_segment_s": 15, "max_concurrent": 2, "max_duration_s": 86_400}
|
|
@@ -337,6 +339,27 @@ async def test_a_start_past_max_concurrent_is_refused_and_a_reason_is_kept(home)
|
|
|
337
339
|
assert ended["ended_by"] == "reset" and after.status_code == 200
|
|
338
340
|
|
|
339
341
|
|
|
342
|
+
@pytest.mark.asyncio
|
|
343
|
+
async def test_list_names_each_recording_still_recording_as_its_start_answered(home):
|
|
344
|
+
async with http_client(FakeDriver()) as http:
|
|
345
|
+
first = (await http.post(START, json={"request_id": "a"})).json()
|
|
346
|
+
second = (await http.post(START, json={"request_id": "b"})).json()
|
|
347
|
+
await http.post(END, json={"recording_id": first["recording_id"]})
|
|
348
|
+
listed = (await http.get(LIST)).json()["recordings"]
|
|
349
|
+
await http.post(END, json={"recording_id": second["recording_id"]})
|
|
350
|
+
after = (await http.get(LIST)).json()["recordings"]
|
|
351
|
+
assert listed == [{"recording_id": second["recording_id"], "started_at": second["started_at"]}] and after == []
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
@pytest.mark.asyncio
|
|
355
|
+
async def test_list_takes_the_control_token_as_every_framework_only_route_does(home, monkeypatch):
|
|
356
|
+
monkeypatch.setenv(CONTROL_TOKEN_ENV, "s3cret")
|
|
357
|
+
async with http_client(FakeDriver()) as http:
|
|
358
|
+
refused = await http.get(LIST)
|
|
359
|
+
allowed = await http.get(LIST, headers={"Authorization": "Bearer s3cret"})
|
|
360
|
+
assert refused.status_code == 401 and allowed.status_code == 200 and allowed.json() == {"recordings": []}
|
|
361
|
+
|
|
362
|
+
|
|
340
363
|
@pytest.mark.asyncio
|
|
341
364
|
async def test_max_duration_and_a_full_disk_end_a_recording_as_limit(home, monkeypatch):
|
|
342
365
|
driver = FakeDriver()
|
|
File without changes
|