agentenv-framework-protocol 0.1.634__tar.gz → 0.1.635__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.634 → agentenv_framework_protocol-0.1.635}/PKG-INFO +7 -3
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/README.md +6 -2
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/PROFILE.md +5 -1
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/__init__.py +21 -6
- agentenv_framework_protocol-0.1.635/src/agentenv_protocol/atif/reader.py +284 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/validator.py +50 -50
- agentenv_framework_protocol-0.1.635/tests/test_atif_reader.py +155 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_validator.py +36 -1
- agentenv_framework_protocol-0.1.634/src/agentenv_protocol/atif/reader.py +0 -183
- agentenv_framework_protocol-0.1.634/tests/test_atif_reader.py +0 -76
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_atif_copy.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_media_spool.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_secrets.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_snapshot_state.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/_turn_index.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/clock.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/control_token.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/proxy.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/a2a_agent/tasks/v1.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/_image_size.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/adapter.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/builder.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/coding.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/coding.stripped.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/computer_use.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/late_result.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/482405b002a62efa8516c36709a7a100637507670576fa73a20ad5420d55c66f.png +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/55c64d0fcd6f9d5f7c828093857e3fdfda68478bb4e9bd24d481ef391c7804e8.heic +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/67905ad3cc2dd52b1f5f6a6d2814de0396618b29b4238b9af5207aeb69936e6d.mp4 +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/69a8aa01fe5537076d023dd5e9cc4275b39fc0434aa6483a9f58b66ef2f3c896.png +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/82e60066a2de261b6653bcdda90d1cb9a7af2f474cecd82e8d371e8384d72315.png +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/media/845e91831319e89c4d656bdb80c278ac09a7230d61e5dfd2e1b1fbb436ac8917.pdf +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/multi_agent.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/odd_parts.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/subagent.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/fixtures/two_turns.json +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/kit.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/VENDORED.md +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/content.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/final_metrics.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/metrics.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/observation.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/observation_result.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/step.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/subagent_trajectory_ref.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/tool_call.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/models/trajectory.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/profile.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/runner.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/atif/served.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/annotate.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/card.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/checks.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/clock.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/checks.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/driver.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/operations.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/platform.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/recording.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/skill.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/passthrough.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/cdp.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/contexts.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/control.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/environment.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/log.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/network.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/recording.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/scope.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/src/agentenv_protocol/website_browser/stream.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/atif_cases.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/conftest.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_agent_clock.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_atif_media.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_atif_prescribe.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_atif_scrubbing.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_atif_serving.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_atif_turns.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_proxy.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_builder.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_fixtures.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_kit.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_profile.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_atif_vendored.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_contexts.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_log.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_network.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_recording.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_clock.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_conformance_attempts.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_driver.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_recording_annotate.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_screenshot_delay.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_usage.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.634 → agentenv_framework_protocol-0.1.635}/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.635
|
|
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
|
|
@@ -1390,8 +1390,12 @@ the profile's spec, and `fixtures/` holds its canonical examples. The package ne
|
|
|
1390
1390
|
terminal state on its last step. Its `page()` is the live view, built when it's read: closed steps only, so a
|
|
1391
1391
|
reader's earlier page is always a prefix of a later one. A step is rendered once a page serves it and kept, so a
|
|
1392
1392
|
read costs one parse of the document, not a render of every step.
|
|
1393
|
-
- **Readers** (`load`, `tasks`, `media_paths`, `strip_profile`, `is_prefix`) take any
|
|
1394
|
-
without the profile, such as a Harbor task's trajectory.json.
|
|
1393
|
+
- **Readers** (`load`, `tasks`, `task_document`, `media_paths`, `media_refs`, `strip_profile`, `is_prefix`) take any
|
|
1394
|
+
valid ATIF document, with or without the profile, such as a Harbor task's trajectory.json. `task_document` cuts A2A
|
|
1395
|
+
tasks out of a conversation's document as a document of their own (`tasks_document` for tasks found without ids), as a
|
|
1396
|
+
reader showing one turn shows it. `media_refs` names each place a media
|
|
1397
|
+
file is named, with the profile's details for it; `validate(document, media=StoredMedia(sizes))` checks those
|
|
1398
|
+
details against files stored beside the document without reading their bytes.
|
|
1395
1399
|
|
|
1396
1400
|
## A2A agent framework
|
|
1397
1401
|
|
|
@@ -1319,8 +1319,12 @@ the profile's spec, and `fixtures/` holds its canonical examples. The package ne
|
|
|
1319
1319
|
terminal state on its last step. Its `page()` is the live view, built when it's read: closed steps only, so a
|
|
1320
1320
|
reader's earlier page is always a prefix of a later one. A step is rendered once a page serves it and kept, so a
|
|
1321
1321
|
read costs one parse of the document, not a render of every step.
|
|
1322
|
-
- **Readers** (`load`, `tasks`, `media_paths`, `strip_profile`, `is_prefix`) take any
|
|
1323
|
-
without the profile, such as a Harbor task's trajectory.json.
|
|
1322
|
+
- **Readers** (`load`, `tasks`, `task_document`, `media_paths`, `media_refs`, `strip_profile`, `is_prefix`) take any
|
|
1323
|
+
valid ATIF document, with or without the profile, such as a Harbor task's trajectory.json. `task_document` cuts A2A
|
|
1324
|
+
tasks out of a conversation's document as a document of their own (`tasks_document` for tasks found without ids), as a
|
|
1325
|
+
reader showing one turn shows it. `media_refs` names each place a media
|
|
1326
|
+
file is named, with the profile's details for it; `validate(document, media=StoredMedia(sizes))` checks those
|
|
1327
|
+
details against files stored beside the document without reading their bytes.
|
|
1324
1328
|
|
|
1325
1329
|
## A2A agent framework
|
|
1326
1330
|
|
|
@@ -169,7 +169,11 @@ cross-check that reads them; per-part origins, when a reader needs them; and an
|
|
|
169
169
|
producer's output to profile 1.0. `reader=True` checks someone else's document for reading instead: what a producer
|
|
170
170
|
must not write only warns, and the document fails only where agentenv couldn't read it. `media` is the folder the
|
|
171
171
|
document's media paths are relative to, the one holding `media/`, or the files by path; without it only the paths' form
|
|
172
|
-
is checked. `
|
|
172
|
+
is checked. `StoredMedia(sizes)` stands for files stored beside the document whose bytes were checked against their
|
|
173
|
+
names as they were stored, as agent-env's worker checks each file an agent pushes: `media-bytes` then holds the
|
|
174
|
+
profile's sha256 to each file's name and its size to the stored one, without reading the bytes. `validate_media(document, media)` gives the `media-bytes` findings alone, for a document
|
|
175
|
+
newer than these models, which `validate` stops at. `media_refs` lists each
|
|
176
|
+
place a document names a media file, with the profile's details for it, as these checks walk them. `validate_live(pages, final)` checks what a live reader was served, page by page, with the final read. A sub-agent's task is its spawning call's, found through the references, so an embedded sub-agent that no served step references isn't held to `live-unanswered`. On
|
|
173
177
|
the command line: `python -m agentenv_protocol.atif validate FILE [--media DIR] [--reader]`, which prints each finding
|
|
174
178
|
and exits 1 when one is an error.
|
|
175
179
|
|
|
@@ -46,20 +46,35 @@ from .profile import (
|
|
|
46
46
|
read_profile,
|
|
47
47
|
)
|
|
48
48
|
from .kit import KIT_RULES, KitResult, check_adapter
|
|
49
|
-
from .reader import
|
|
49
|
+
from .reader import (
|
|
50
|
+
MEDIA_PATH,
|
|
51
|
+
MediaRef,
|
|
52
|
+
Task,
|
|
53
|
+
check,
|
|
54
|
+
check_media,
|
|
55
|
+
is_prefix,
|
|
56
|
+
load,
|
|
57
|
+
media_file,
|
|
58
|
+
media_paths,
|
|
59
|
+
media_refs,
|
|
60
|
+
strip_profile,
|
|
61
|
+
task_document,
|
|
62
|
+
tasks,
|
|
63
|
+
tasks_document,
|
|
64
|
+
)
|
|
50
65
|
from .runner import AdapterRun, Fed, RecordedTask, replay
|
|
51
66
|
from .served import AuxEntry, ContentItem, MediaItem, ServedData, ServedError, ServedMedia, ServedTurn
|
|
52
|
-
from .validator import RULES, Finding, Rule, errors_in, validate, validate_live
|
|
67
|
+
from .validator import RULES, Finding, Rule, StoredMedia, errors_in, validate, validate_live, validate_media
|
|
53
68
|
|
|
54
69
|
__all__ = [
|
|
55
70
|
"Adapter", "AdapterRef", "AdapterRun", "AdapterSpec", "Agent", "AgentProfile", "Arrival", "atif_adapter",
|
|
56
71
|
"AtifError", "AtifTurn", "AudioSource", "aux", "AuxEntry", "check", "check_adapter", "check_media", "ContentItem", "ContentPart",
|
|
57
72
|
"Document", "dump_profile", "errors_in", "Fed", "FinalMetrics", "FinalMetricsProfile", "Finding", "finish",
|
|
58
73
|
"FORMAT", "ImageSource", "is_prefix", "KIT_RULES", "KitResult", "load", "Media", "MEDIA_PATH", "media_file", "media_paths", "MediaInfo",
|
|
59
|
-
"MediaItem", "Metrics", "MetricsProfile", "Native", "native", "Observation", "ObservationResult",
|
|
74
|
+
"MediaItem", "MediaRef", "media_refs", "Metrics", "MetricsProfile", "Native", "native", "Observation", "ObservationResult",
|
|
60
75
|
"ObservationResultProfile", "PROFILE_KEY", "profile_of", "PROFILE_VERSION", "PROFILES", "RAW_ARGUMENTS",
|
|
61
76
|
"read_profile", "ReasoningBlock", "RecordedTask", "replay", "Rule", "RULES", "SCHEMA_VERSION", "Selector",
|
|
62
|
-
"ServedData", "ServedError", "ServedMedia", "ServedTurn", "Step", "StepData", "StepError", "StepProfile",
|
|
63
|
-
"strip_profile", "SubagentTrajectoryRef", "SubagentTrajectoryRefProfile", "Task", "tasks", "timestamp", "ToolCall",
|
|
64
|
-
"ToolCallProfile", "Trajectory", "TrajectoryProfile", "TurnContext", "validate", "validate_live", "VOCABULARIES",
|
|
77
|
+
"ServedData", "ServedError", "ServedMedia", "ServedTurn", "Step", "StepData", "StepError", "StepProfile", "StoredMedia",
|
|
78
|
+
"strip_profile", "SubagentTrajectoryRef", "SubagentTrajectoryRefProfile", "Task", "task_document", "tasks", "tasks_document", "timestamp", "ToolCall",
|
|
79
|
+
"ToolCallProfile", "Trajectory", "TrajectoryProfile", "TurnContext", "validate", "validate_live", "validate_media", "VOCABULARIES",
|
|
65
80
|
]
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"""Reading ATIF documents, with or without ``extra.agentenv``: load and check one with the vendored models, slice it
|
|
2
|
+
into its A2A tasks, list the media it names, strip the profile, and tell whether a live page is a prefix of a later
|
|
3
|
+
read. Every helper accepts any valid ATIF document, such as a Harbor task's trajectory.json."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import copy
|
|
7
|
+
import hashlib
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any, Iterable, Iterator, Mapping
|
|
13
|
+
|
|
14
|
+
from pydantic import ValidationError
|
|
15
|
+
|
|
16
|
+
from .models import Trajectory
|
|
17
|
+
from .profile import PROFILE_KEY, AtifError, profile_of
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _no_constant(name: str) -> Any:
|
|
21
|
+
raise AtifError(f"{name} isn't JSON")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def load(source: str | bytes | Path | Mapping[str, Any]) -> dict[str, Any]:
|
|
25
|
+
"""A document from JSON text, a file or a parsed mapping, checked with the vendored ATIF models. JSON is read
|
|
26
|
+
strictly: UTF-8, and no NaN or infinity."""
|
|
27
|
+
if isinstance(source, Path):
|
|
28
|
+
source = source.read_bytes()
|
|
29
|
+
if isinstance(source, (bytes, bytearray)):
|
|
30
|
+
try:
|
|
31
|
+
source = bytes(source).decode("utf-8")
|
|
32
|
+
except UnicodeDecodeError as exc:
|
|
33
|
+
raise AtifError(f"a document is UTF-8: {exc}") from exc
|
|
34
|
+
if isinstance(source, str):
|
|
35
|
+
try:
|
|
36
|
+
source = json.loads(source, parse_constant=_no_constant)
|
|
37
|
+
except json.JSONDecodeError as exc:
|
|
38
|
+
raise AtifError(f"a document isn't JSON: {exc}") from exc
|
|
39
|
+
if not isinstance(source, Mapping):
|
|
40
|
+
raise AtifError("a document is a JSON object")
|
|
41
|
+
document = copy.deepcopy(dict(source))
|
|
42
|
+
check(document)
|
|
43
|
+
return document
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def check(document: Mapping[str, Any]) -> Trajectory:
|
|
47
|
+
"""The document as ATIF's own models read it, or AtifError naming what they refused."""
|
|
48
|
+
try:
|
|
49
|
+
return Trajectory.model_validate(document)
|
|
50
|
+
except ValidationError as exc:
|
|
51
|
+
raise AtifError(f"not valid ATIF: {exc}") from exc
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True)
|
|
55
|
+
class Task:
|
|
56
|
+
"""One A2A task's steps: from its user step up to the next task's. The ids and turn come from the user step's
|
|
57
|
+
profile; without one, ``turn`` counts the tasks in order and the ids are None."""
|
|
58
|
+
|
|
59
|
+
turn: int
|
|
60
|
+
steps: list[dict[str, Any]] = field(default_factory=list)
|
|
61
|
+
task_id: str | None = None
|
|
62
|
+
context_id: str | None = None
|
|
63
|
+
message_id: str | None = None
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def state(self) -> str | None:
|
|
67
|
+
"""The task's terminal state, which the profile puts on its last step."""
|
|
68
|
+
return profile_of(self.steps[-1]).get("state") if self.steps else None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def tasks(document: Mapping[str, Any]) -> list[Task]:
|
|
72
|
+
"""The root trajectory's steps sliced into A2A tasks. A task starts at a user step: one carrying a task id in its
|
|
73
|
+
profile, or, in a document without the profile, any ``source: user`` step."""
|
|
74
|
+
steps = list(document.get("steps") or [])
|
|
75
|
+
profiled = any(profile_of(s).get("task_id") for s in steps if s.get("source") == "user")
|
|
76
|
+
out: list[Task] = []
|
|
77
|
+
for step in steps:
|
|
78
|
+
profile = profile_of(step)
|
|
79
|
+
starts = step.get("source") == "user" and (profile.get("task_id") is not None or not profiled)
|
|
80
|
+
if starts or not out:
|
|
81
|
+
turn = profile.get("turn") if isinstance(profile.get("turn"), int) else len(out)
|
|
82
|
+
out.append(Task(turn=turn, task_id=profile.get("task_id"), context_id=profile.get("context_id"),
|
|
83
|
+
message_id=profile.get("message_id")))
|
|
84
|
+
out[-1].steps.append(step)
|
|
85
|
+
return out
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def task_document(document: Mapping[str, Any], task_ids: Iterable[str]) -> dict[str, Any]:
|
|
89
|
+
"""The A2A tasks ``task_ids`` names, cut out of ``document`` as a document of their own that ATIF's models load: their
|
|
90
|
+
steps in order, renumbered from 1 with each result's arrival step to match, the root's sub-agents those steps reach
|
|
91
|
+
kept whole (and those a kept one reaches, from any depth inside it, each reference resolved where it sits), and the
|
|
92
|
+
root's ``final_metrics`` and ``continued_trajectory_ref`` dropped, since they describe the whole document. A reader that shows one turn shows this. KeyError naming a task it doesn't hold."""
|
|
93
|
+
wanted = list(task_ids)
|
|
94
|
+
picked = [task for task in tasks(document) if task.task_id in wanted]
|
|
95
|
+
missing = [task_id for task_id in wanted if task_id not in {task.task_id for task in picked}]
|
|
96
|
+
if missing:
|
|
97
|
+
raise KeyError(f"the document holds no task {', '.join(map(repr, missing))}")
|
|
98
|
+
return tasks_document(document, picked)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def tasks_document(document: Mapping[str, Any], picked: Iterable[Task]) -> dict[str, Any]:
|
|
102
|
+
"""``task_document`` for tasks already found among ``tasks(document)``, such as the tasks of a document without the
|
|
103
|
+
profile, which carry no ids."""
|
|
104
|
+
steps = [copy.deepcopy(step) for task in picked for step in task.steps]
|
|
105
|
+
numbers = {step.get("step_id"): n for n, step in enumerate(steps, 1)}
|
|
106
|
+
for n, step in enumerate(steps, 1):
|
|
107
|
+
step["step_id"] = n
|
|
108
|
+
for result in (step.get("observation") or {}).get("results") or []:
|
|
109
|
+
arrived = ((result.get("extra") or {}).get(PROFILE_KEY) or {}).get("arrived")
|
|
110
|
+
if isinstance(arrived, dict) and "step_id" in arrived:
|
|
111
|
+
if arrived["step_id"] in numbers:
|
|
112
|
+
arrived["step_id"] = numbers[arrived["step_id"]]
|
|
113
|
+
else:
|
|
114
|
+
del arrived["step_id"]
|
|
115
|
+
subs = list(document.get("subagent_trajectories") or [])
|
|
116
|
+
resolve = _resolver(document)
|
|
117
|
+
reached: set[int] = set()
|
|
118
|
+
frontier = _reached(resolve[""], steps)
|
|
119
|
+
while frontier:
|
|
120
|
+
index = frontier.pop()
|
|
121
|
+
if index not in reached:
|
|
122
|
+
reached.add(index)
|
|
123
|
+
for prefix, trajectory in _trajectories(subs[index], f"subagent_trajectories[{index}]."):
|
|
124
|
+
frontier += _reached(resolve[prefix], trajectory.get("steps") or [])
|
|
125
|
+
cut = {key: copy.deepcopy(value) for key, value in document.items()
|
|
126
|
+
if key not in ("steps", "subagent_trajectories", "final_metrics", "continued_trajectory_ref")}
|
|
127
|
+
cut["steps"] = steps
|
|
128
|
+
kept = [copy.deepcopy(sub) for index, sub in enumerate(subs) if index in reached]
|
|
129
|
+
if kept:
|
|
130
|
+
cut["subagent_trajectories"] = kept
|
|
131
|
+
return cut
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _reached(visible: Mapping[Any, str], steps: Iterable[Mapping[str, Any]]) -> list[int]:
|
|
135
|
+
"""The index among the root's sub-agents of each one the references in ``steps`` name, or name one inside."""
|
|
136
|
+
return [int(_ROOT_SUB.match(visible[ref.get("trajectory_id")])[1]) for step in steps
|
|
137
|
+
for result in (step.get("observation") or {}).get("results") or []
|
|
138
|
+
for ref in result.get("subagent_trajectory_ref") or [] if ref.get("trajectory_id") in visible]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
_ROOT_SUB = re.compile(r"subagent_trajectories\[(\d+)\]\.")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _resolver(document: Mapping[str, Any], prefix: str = "",
|
|
145
|
+
outer: Mapping[Any, str] | None = None) -> dict[str, dict[Any, str]]:
|
|
146
|
+
"""For each trajectory, by its path prefix, the sub-agent each id a reference in it names: one embedded in it,
|
|
147
|
+
else the nearest one embedded around it, by path prefix. ATIF makes an id unique only within its parent's array,
|
|
148
|
+
and the builder embeds every sub-agent in the root."""
|
|
149
|
+
subs = list(document.get("subagent_trajectories") or [])
|
|
150
|
+
visible = {**(outer or {}), **{sub.get("trajectory_id"): f"{prefix}subagent_trajectories[{index}]."
|
|
151
|
+
for index, sub in enumerate(subs)}}
|
|
152
|
+
out = {prefix: visible}
|
|
153
|
+
for index, sub in enumerate(subs):
|
|
154
|
+
out.update(_resolver(sub, f"{prefix}subagent_trajectories[{index}].", visible))
|
|
155
|
+
return out
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _trajectories(document: Mapping[str, Any], prefix: str = "") -> Iterator[tuple[str, Mapping[str, Any]]]:
|
|
159
|
+
"""The document and every sub-agent embedded in it, at any depth, with the path prefix of each."""
|
|
160
|
+
yield prefix, document
|
|
161
|
+
for index, sub in enumerate(document.get("subagent_trajectories") or []):
|
|
162
|
+
yield from _trajectories(sub, f"{prefix}subagent_trajectories[{index}].")
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#: A media file's name, ``<sha256>.<ext>``: what its bytes are, never a secret.
|
|
166
|
+
MEDIA_NAME = re.compile(r"(?P<sha256>[0-9a-f]{64})\.[A-Za-z0-9]+")
|
|
167
|
+
#: The only path a media file of a document can have: ``media/<sha256>.<ext>``, in the document's own folder.
|
|
168
|
+
MEDIA_PATH = re.compile(rf"^media/{MEDIA_NAME.pattern}$")
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def media_file(path: str) -> str:
|
|
172
|
+
"""``path``'s sha256, once ``path`` is ``media/<sha256>.<ext>``: a part path resolves only to a file in the
|
|
173
|
+
document's own media folder, never to another path or a URL. AtifError otherwise."""
|
|
174
|
+
named = MEDIA_PATH.match(path) if isinstance(path, str) else None
|
|
175
|
+
if named is None:
|
|
176
|
+
raise AtifError(f"{path!r} isn't media/<sha256>.<ext> in the document's folder")
|
|
177
|
+
return named["sha256"]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def check_media(path: str, data: bytes) -> None:
|
|
181
|
+
"""Refuse media whose bytes aren't what its name says: a reader checks each file it reads, since a store can hold
|
|
182
|
+
another file under that name. AtifError naming the difference."""
|
|
183
|
+
digest = hashlib.sha256(data).hexdigest()
|
|
184
|
+
if media_file(path) != digest:
|
|
185
|
+
raise AtifError(f"{path}'s bytes have sha256 {digest}")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@dataclass(frozen=True)
|
|
189
|
+
class MediaRef:
|
|
190
|
+
"""One place a document names a media file: its ``path``, ``where`` it's named (such as
|
|
191
|
+
``steps[2].message[1].source.path``), the profile's details for it ({} without) and the media type of the part
|
|
192
|
+
that names it, else the details' own."""
|
|
193
|
+
|
|
194
|
+
path: str
|
|
195
|
+
where: str
|
|
196
|
+
info: Mapping[str, Any]
|
|
197
|
+
media_type: str | None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def media_refs(document: Mapping[str, Any]) -> list[MediaRef]:
|
|
201
|
+
"""Every place the document and the sub-agents embedded in it name a media file, in order: in each step's message
|
|
202
|
+
and each result's content, the image and audio parts' paths, then the files the profile records beside them for
|
|
203
|
+
media ATIF has no part type for."""
|
|
204
|
+
refs: list[MediaRef] = []
|
|
205
|
+
for prefix, trajectory in _trajectories(document):
|
|
206
|
+
for index, step in enumerate(trajectory.get("steps") or []):
|
|
207
|
+
where = f"{prefix}steps[{index}]"
|
|
208
|
+
holders = [(where, step, step.get("message"), "message")] + [
|
|
209
|
+
(f"{where}.observation.results[{n}]", result, result.get("content"), "content")
|
|
210
|
+
for n, result in enumerate((step.get("observation") or {}).get("results") or [])]
|
|
211
|
+
for owner, holder, content, field_name in holders:
|
|
212
|
+
details = profile_of(holder).get("media") or {}
|
|
213
|
+
details = details if isinstance(details, Mapping) else {}
|
|
214
|
+
named: set[str] = set()
|
|
215
|
+
for n, part in enumerate(content if isinstance(content, list) else []):
|
|
216
|
+
source = part.get("source") if isinstance(part, Mapping) else None
|
|
217
|
+
if isinstance(source, Mapping) and isinstance(source.get("path"), str):
|
|
218
|
+
path, info = source["path"], _details(details, source["path"])
|
|
219
|
+
named.add(path)
|
|
220
|
+
refs.append(MediaRef(path, f"{owner}.{field_name}[{n}].source.path", info,
|
|
221
|
+
source.get("media_type") or info.get("media_type")))
|
|
222
|
+
refs += [MediaRef(path, f"{owner}.extra.{PROFILE_KEY}.media[{path}]", _details(details, path),
|
|
223
|
+
_details(details, path).get("media_type"))
|
|
224
|
+
for path in details if path not in named]
|
|
225
|
+
return refs
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _details(details: Mapping[str, Any], path: str) -> Mapping[str, Any]:
|
|
229
|
+
info = details.get(path)
|
|
230
|
+
return info if isinstance(info, Mapping) else {}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def media_paths(document: Mapping[str, Any]) -> list[str]:
|
|
234
|
+
"""Every media file the document names, once each, in the order they appear: image and audio parts' paths, and
|
|
235
|
+
the files the profile records for media ATIF has no part type for."""
|
|
236
|
+
return list(dict.fromkeys(ref.path for ref in media_refs(document)))
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def strip_profile(document: Mapping[str, Any]) -> dict[str, Any]:
|
|
240
|
+
"""A copy without the profile: ``extra.agentenv`` taken off each ATIF object that has an ``extra``, and an
|
|
241
|
+
``extra`` left empty with it. Tool arguments and every other free-form value stay as they are."""
|
|
242
|
+
stripped = copy.deepcopy(dict(document))
|
|
243
|
+
_strip_trajectory(stripped)
|
|
244
|
+
return stripped
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _strip_trajectory(trajectory: dict[str, Any]) -> None:
|
|
248
|
+
for owner in (trajectory, trajectory.get("agent"), trajectory.get("final_metrics")):
|
|
249
|
+
_strip(owner)
|
|
250
|
+
for step in trajectory.get("steps") or []:
|
|
251
|
+
_strip(step)
|
|
252
|
+
_strip(step.get("metrics"))
|
|
253
|
+
for call in step.get("tool_calls") or []:
|
|
254
|
+
_strip(call)
|
|
255
|
+
for result in (step.get("observation") or {}).get("results") or []:
|
|
256
|
+
_strip(result)
|
|
257
|
+
for ref in result.get("subagent_trajectory_ref") or []:
|
|
258
|
+
_strip(ref)
|
|
259
|
+
for sub in trajectory.get("subagent_trajectories") or []:
|
|
260
|
+
_strip_trajectory(sub)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _strip(owner: Any) -> None:
|
|
264
|
+
extra = owner.get("extra") if isinstance(owner, dict) else None
|
|
265
|
+
if isinstance(extra, dict) and PROFILE_KEY in extra:
|
|
266
|
+
del extra[PROFILE_KEY]
|
|
267
|
+
if not extra:
|
|
268
|
+
del owner["extra"]
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def is_prefix(page: Mapping[str, Any] | None, later: Mapping[str, Any] | None) -> bool:
|
|
272
|
+
"""Whether a live page's steps are the first steps of a later read, trajectory by trajectory. Nothing served is a
|
|
273
|
+
prefix of anything."""
|
|
274
|
+
if page is None:
|
|
275
|
+
return True
|
|
276
|
+
if later is None:
|
|
277
|
+
return False
|
|
278
|
+
if list(later.get("steps") or [])[:len(page.get("steps") or [])] != list(page.get("steps") or []):
|
|
279
|
+
return False
|
|
280
|
+
subs = {sub.get("trajectory_id"): sub for sub in later.get("subagent_trajectories") or []}
|
|
281
|
+
for sub in page.get("subagent_trajectories") or []:
|
|
282
|
+
if not is_prefix(sub, subs.get(sub.get("trajectory_id"))):
|
|
283
|
+
return False
|
|
284
|
+
return True
|
|
@@ -26,7 +26,7 @@ from .profile import (
|
|
|
26
26
|
StepError,
|
|
27
27
|
profile_of,
|
|
28
28
|
)
|
|
29
|
-
from .reader import MEDIA_PATH, is_prefix, tasks
|
|
29
|
+
from .reader import MEDIA_PATH, _resolver, _trajectories, is_prefix, media_refs, tasks
|
|
30
30
|
|
|
31
31
|
ERROR = "error"
|
|
32
32
|
WARNING = "warning"
|
|
@@ -131,17 +131,26 @@ def parse(source: str | bytes | Path) -> tuple[Any, list[Finding]]:
|
|
|
131
131
|
return None, [Finding("json", ERROR, "", str(exc))]
|
|
132
132
|
|
|
133
133
|
|
|
134
|
+
@dataclass(frozen=True)
|
|
135
|
+
class StoredMedia:
|
|
136
|
+
"""Media files stored beside a document by one who checked each file's bytes against its name, as the worker does
|
|
137
|
+
each file an agent pushes: their sizes by path, None where the store can't tell. Given these, ``validate`` holds
|
|
138
|
+
the profile's sha256 to each name and its size to the stored file's without reading the bytes."""
|
|
139
|
+
|
|
140
|
+
sizes: Mapping[str, int | None]
|
|
141
|
+
|
|
142
|
+
|
|
134
143
|
def validate(document: Any, *, reader: bool = False,
|
|
135
|
-
media: Path | Mapping[str, bytes] | None = None) -> list[Finding]:
|
|
144
|
+
media: Path | Mapping[str, bytes] | StoredMedia | None = None) -> list[Finding]:
|
|
136
145
|
"""Every finding for ``document``. ``reader`` checks someone else's document for reading rather than a producer's
|
|
137
|
-
output. ``media`` is the folder the document's media paths are relative to,
|
|
138
|
-
the paths' form is checked."""
|
|
146
|
+
output. ``media`` is the folder the document's media paths are relative to, the files by path, or the files stored
|
|
147
|
+
beside it (``StoredMedia``); without it, only the paths' form is checked."""
|
|
139
148
|
found = _Findings(reader)
|
|
140
149
|
_check(document, found, media)
|
|
141
150
|
return found.items
|
|
142
151
|
|
|
143
152
|
|
|
144
|
-
def _check(document: Any, found: _Findings, media: Path | Mapping[str, bytes] | None) -> None:
|
|
153
|
+
def _check(document: Any, found: _Findings, media: Path | Mapping[str, bytes] | StoredMedia | None) -> None:
|
|
145
154
|
if not isinstance(document, Mapping):
|
|
146
155
|
found.add("json", "", "a document is a JSON object")
|
|
147
156
|
return
|
|
@@ -210,13 +219,6 @@ def validate_live(pages: Sequence[Mapping[str, Any] | None], final: Mapping[str,
|
|
|
210
219
|
|
|
211
220
|
# What the document holds
|
|
212
221
|
|
|
213
|
-
def _trajectories(document: Mapping[str, Any], prefix: str = "") -> Iterator[tuple[str, Mapping[str, Any]]]:
|
|
214
|
-
"""The document and every sub-agent embedded in it, at any depth, with the path prefix of each."""
|
|
215
|
-
yield prefix, document
|
|
216
|
-
for index, sub in enumerate(document.get("subagent_trajectories") or []):
|
|
217
|
-
yield from _trajectories(sub, f"{prefix}subagent_trajectories[{index}].")
|
|
218
|
-
|
|
219
|
-
|
|
220
222
|
def _count(value: Any) -> int | None:
|
|
221
223
|
"""A token count as ATIF's models read it, a numeric string included, or None when there is none."""
|
|
222
224
|
try:
|
|
@@ -321,20 +323,6 @@ def _outside_keys(objects: list[tuple[str, str, Mapping[str, Any]]], found: _Fin
|
|
|
321
323
|
f"the profile names no key outside extra.{PROFILE_KEY} here")
|
|
322
324
|
|
|
323
325
|
|
|
324
|
-
def _resolver(document: Mapping[str, Any], prefix: str = "",
|
|
325
|
-
outer: Mapping[Any, str] | None = None) -> dict[str, dict[Any, str]]:
|
|
326
|
-
"""For each trajectory, by its path prefix, the sub-agent each id a reference in it names: one embedded in it,
|
|
327
|
-
else the nearest one embedded around it, by path prefix. ATIF makes an id unique only within its parent's array,
|
|
328
|
-
and the builder embeds every sub-agent in the root."""
|
|
329
|
-
subs = list(document.get("subagent_trajectories") or [])
|
|
330
|
-
visible = {**(outer or {}), **{sub.get("trajectory_id"): f"{prefix}subagent_trajectories[{index}]."
|
|
331
|
-
for index, sub in enumerate(subs)}}
|
|
332
|
-
out = {prefix: visible}
|
|
333
|
-
for index, sub in enumerate(subs):
|
|
334
|
-
out.update(_resolver(sub, f"{prefix}subagent_trajectories[{index}].", visible))
|
|
335
|
-
return out
|
|
336
|
-
|
|
337
|
-
|
|
338
326
|
def _calls_and_references(document: Mapping[str, Any], found: _Findings) -> None:
|
|
339
327
|
resolve = _resolver(document)
|
|
340
328
|
seen: dict[str, str] = {}
|
|
@@ -397,15 +385,35 @@ def _usage(document: Mapping[str, Any], found: _Findings) -> None:
|
|
|
397
385
|
f"cache reads and writes ({cache}) exceed prompt_tokens ({prompt}), which include them")
|
|
398
386
|
|
|
399
387
|
|
|
400
|
-
def
|
|
401
|
-
|
|
388
|
+
def validate_media(document: Mapping[str, Any], media: Path | Mapping[str, bytes] | StoredMedia, *,
|
|
389
|
+
reader: bool = False) -> list[Finding]:
|
|
390
|
+
"""The ``media-bytes`` findings alone, for a document ``media_refs`` can walk, whether or not ATIF's models accept
|
|
391
|
+
it: a document newer than these models, which ``validate`` stops at, still names files a reader needs."""
|
|
392
|
+
found = _Findings(reader)
|
|
393
|
+
_media_files(document, found, media)
|
|
394
|
+
return found.items
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def _media(document: Mapping[str, Any], found: _Findings,
|
|
398
|
+
media: Path | Mapping[str, bytes] | StoredMedia | None) -> None:
|
|
399
|
+
for ref in media_refs(document):
|
|
400
|
+
if "://" in ref.path:
|
|
401
|
+
found.add("media-path", ref.where,
|
|
402
|
+
f"{ref.path!r} is a URL; the profile's media are files beside the document")
|
|
403
|
+
elif not MEDIA_PATH.match(ref.path):
|
|
404
|
+
found.add("media-path", ref.where, f"{ref.path!r} isn't media/<sha256>.<ext>")
|
|
405
|
+
if media is not None:
|
|
406
|
+
_media_files(document, found, media)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _media_files(document: Mapping[str, Any], found: _Findings, media: Path | Mapping[str, bytes] | StoredMedia) -> None:
|
|
410
|
+
for ref in media_refs(document):
|
|
411
|
+
where, path, info = ref.where, ref.path, ref.info
|
|
402
412
|
if "://" in path:
|
|
403
|
-
found.add("media-path", where, f"{path!r} is a URL; the profile's media are files beside the document")
|
|
404
413
|
continue
|
|
405
414
|
named = MEDIA_PATH.match(path)
|
|
406
|
-
if
|
|
407
|
-
found
|
|
408
|
-
if media is None:
|
|
415
|
+
if isinstance(media, StoredMedia):
|
|
416
|
+
_stored(found, where, path, named, info, media)
|
|
409
417
|
continue
|
|
410
418
|
data = _media_bytes(media, path)
|
|
411
419
|
if data is None:
|
|
@@ -420,24 +428,16 @@ def _media(document: Mapping[str, Any], found: _Findings, media: Path | Mapping[
|
|
|
420
428
|
found.add("media-bytes", where, f"the profile gives {info['bytes']} bytes, but the file has {len(data)}")
|
|
421
429
|
|
|
422
430
|
|
|
423
|
-
def
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
for n, part in enumerate(parts if isinstance(parts, list) else [])
|
|
434
|
-
if isinstance(part, Mapping) and isinstance((part.get("source") or {}).get("path"), str)]
|
|
435
|
-
listed = {path for _, path in paths}
|
|
436
|
-
owner = at.rsplit(".", 1)[0]
|
|
437
|
-
paths += [(f"{owner}.extra.{PROFILE_KEY}.media[{path}]", path) for path in details if path not in listed]
|
|
438
|
-
for path_where, path in paths:
|
|
439
|
-
info = details.get(path)
|
|
440
|
-
yield path_where, path, info if isinstance(info, Mapping) else {}
|
|
431
|
+
def _stored(found: _Findings, where: str, path: str, named: re.Match[str] | None, info: Mapping[str, Any],
|
|
432
|
+
media: StoredMedia) -> None:
|
|
433
|
+
if path not in media.sizes:
|
|
434
|
+
found.add("media-bytes", where, f"{path} isn't in the media given")
|
|
435
|
+
return
|
|
436
|
+
if named and info.get("sha256") is not None and info["sha256"] != named["sha256"]:
|
|
437
|
+
found.add("media-bytes", where, f"the profile gives sha256 {info['sha256']}, but the name has {named['sha256']}")
|
|
438
|
+
size = media.sizes[path]
|
|
439
|
+
if info.get("bytes") is not None and size is not None and info["bytes"] != size:
|
|
440
|
+
found.add("media-bytes", where, f"the profile gives {info['bytes']} bytes, but the file has {size}")
|
|
441
441
|
|
|
442
442
|
|
|
443
443
|
def _media_bytes(media: Path | Mapping[str, bytes], path: str) -> bytes | None:
|