graphcore-kernel 0.1.0__tar.gz → 0.2.1__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.
- {graphcore_kernel-0.1.0/graphcore_kernel.egg-info → graphcore_kernel-0.2.1}/PKG-INFO +1 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/__init__.py +2 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/api.py +15 -4
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/base/__init__.py +2 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/base/views.py +4 -9
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/client.py +3 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/context.py +7 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/render.py +14 -6
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/server.py +27 -7
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/testing.py +3 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/fakes.py +7 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/test_frontend.py +110 -9
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/test_server.py +55 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tools.py +70 -10
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/graph_api.py +6 -0
- graphcore_kernel-0.2.1/graphcore/api/tests/test_strategy_tokens.py +144 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/README.md +50 -4
- graphcore_kernel-0.2.1/graphcore/auth/authn/strategy_tokens.py +38 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/AGENT_FRONTEND_TDD.md +41 -7
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/AUTHORIZATION_TECHNICAL_TDD.md +15 -12
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/STRATEGY_EXECUTION_TDD.md +34 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/BaseStrategy.py +12 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/RequestTemplateStrategies.py +17 -5
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/StrategyExecutorService.py +24 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/support.py +30 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_executor.py +26 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/app_discovery.py +72 -14
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/discovery.py +6 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_import_package.py +12 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/test_ticks.py +20 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/case.py +27 -3
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/public_api_manifest.py +2 -2
- graphcore_kernel-0.2.1/graphcore/tests/test_app_discovery.py +162 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_composition_boundaries.py +3 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/agent_asgi.py +19 -2
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/agent_client.py +15 -3
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/views.py +7 -3
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/strategy.py +11 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1/graphcore_kernel.egg-info}/PKG-INFO +1 -1
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore_kernel.egg-info/SOURCES.txt +2 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/pyproject.toml +1 -1
- graphcore_kernel-0.1.0/graphcore/tests/test_app_discovery.py +0 -90
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/LICENSE +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/NOTICE +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/README.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/errors.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/loading.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/registry.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/signatures.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/test_loading.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/predicate_codec.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_changed_entities.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_graph_api.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_graph_api_access.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_graph_api_grants.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_predicate_codec.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/api/tests/test_subtree_query.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/apps.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/authenticator.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/onboarding.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/principals.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/resource_metadata.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/service_accounts.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/testing.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/tests/test_authenticator.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/tests/test_onboarding.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/tests/test_service_accounts.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authn/users.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/access_port.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/default_access_adapter.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/tests/test_default_adapter.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/tests/test_entity_write_hooks.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/tests/test_group_types.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/adapter/tests/test_sync_support.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/defaults.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/kernel_policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/kernel_writes.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/lookups.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_can_contain.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_contained_by.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_creation.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_delete_permission.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_granted_to_me.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_integration.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_invites.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_kernel_policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_lockout.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_primitives.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/auth/authz/tests/test_principal_creation.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/bootstrap/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/bootstrap/deployment.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/bootstrap/signals.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/bootstrap/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/bootstrap/tests/test_deployment_seed.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/broadcast/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/broadcast/broadcaster.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/broadcast/channels.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/broadcast/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/broadcast/tests/test_broadcaster.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/celery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/ARCHITECTURE_PRINCIPLES.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/ENTITY_REFERENCE_TDD.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/GRAPHAPI_FRONT_DOOR.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/RUNTIME.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/SCHEDULING_TDD.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/VIEW_ENTITY_TDD.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/VIEW_SYSTEM_TDD.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/doc_topics.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/docs_discovery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/docs/public_api.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/Entity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/deployment/Deployment.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/deployment/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/grant/Grant.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/grant/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/group/Group.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/group/README.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/group/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/invite/Invite.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/invite/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/request_template/RequestTemplate.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/request_template/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/request_template/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/request_template/tests/test_request_template.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/service_account/ServiceAccount.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/service_account/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/strategy_request/StrategyRequest.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/strategy_request/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/strategy_request/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/strategy_request/tests/test_strategy_request_entity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/tests/test_entity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/tests/test_grant_group_entities.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/tests/test_write_once_fields.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/user/User.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/user/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/user/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/user/tests/test_user_entity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/View.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/position.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/tests/test_position.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/entity/view/tests/test_view_entity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/DeploymentStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/GrantStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/GroupStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/InviteStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/ViewStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/runner.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/session.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/BaseStrategyTest.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_BaseStrategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_grant_strategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_group_strategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_runner.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_strategy_locks.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_utils.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/domain/strategy/tests/test_view_strategies.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/errors.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/README.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/dispatcher.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/environments/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/environments/celery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/environments/in_process.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/local_session.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/redis_run_events.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/requests.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/run_events.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/strategy_context.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tasks.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/contract.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_dispatchers.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_local_session.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_reconcile_runs.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_run_events.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/execution/tests/test_strategy_context.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/gateway/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/gateway/remote.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/gateway/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/gateway/tests/test_remote.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/EntityService.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/entity_cache.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_EntityService.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_EntityService_list.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_EntityService_model_resolution.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_EntityService_referrers.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_EntityService_routing.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_dependent_on.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_engine_is_type_agnostic.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_engine_resolves_read_permission.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_entity_cache.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/graph/tests/test_null_entity_cache.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/commands/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/commands/dev_reset.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/commands/graphcore_createadmin.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/commands/graphcore_policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/commands/graphcore_status.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/tests/test_createadmin.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/tests/test_policy_command.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/management/tests/test_status_command.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/migrations/0001_initial.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/migrations/0002_invite.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/migrations/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/models.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/ENTITY_REPOSITORY_TECHNICAL_TDD.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/backends.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/bindings.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/cache.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/compiler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/identity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/models.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/repository.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_backends.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_compiler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_repository.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_shared_column.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_threads.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/tests/test_update_shape.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/django/threads.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/repository.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/contract.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/evaluate.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/fixtures.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/memory.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/test_memory_repository.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/persistence/tests/test_query_types.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/api.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/apps.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/grants.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/onboarding.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/perms.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/policy.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/roles.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/auth/subjects.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/entities/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/errors.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/persistence/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/persistence/django.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/scheduling.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/strategies/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/test_settings.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/public/testing.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/EntityDirectory.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/README.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/StrategyDirectory.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/TYPE_METADATA_PLACEMENT.md +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/decorators.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/registry.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_agent_frontend_discovery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_app_config.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_discovery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_entity_directory_storage.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_principal_flag.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/registry/tests/test_strategy_directory.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/routes/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/routes/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/routes/tests/test_routes.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/runtime.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/beat_scheduler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/beat_tasks.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/scheduler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/contract.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/memory.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/test_beat_scheduler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/scheduling/tests/test_memory_scheduler.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tasks.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/test_settings.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/runner.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/settings.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/tests/agent_view_fixture.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/tests/test_case_and_runner.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/testing/tests/test_settings_for_apps.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/ids.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/runs.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_docs_discovery.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_no_print.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_packaging.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_public_api_boundaries.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_public_api_contract.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_public_api_docs.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_runtime.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_shared_type_boundaries.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_shared_types.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/tests/test_test_settings.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/channel_layer.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/consumers.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/routing.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/test_agent_client.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/test_api_views.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/test_channel_layer.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/test_consumers.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/tests/test_resource_metadata.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/transport/urls.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/access.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/api.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/entities.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/entity_id.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/execution.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/identity.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/onboarding.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/query.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/schedules.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/tests/__init__.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/types/tests/test_entity_id.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/urls.py +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore_kernel.egg-info/dependency_links.txt +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore_kernel.egg-info/entry_points.txt +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore_kernel.egg-info/requires.txt +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore_kernel.egg-info/top_level.txt +0 -0
- {graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from graphcore.agent_frontend.api import AgentView, ToolSpec, agent_view, operation, strategy_tool
|
|
1
|
+
from graphcore.agent_frontend.api import AgentView, Image, ToolSpec, agent_view, operation, strategy_tool
|
|
2
2
|
from graphcore.agent_frontend.context import Context
|
|
3
3
|
from graphcore.agent_frontend.errors import AgentError, RenderTooLarge
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
|
-
'AgentError', 'AgentView', 'Context', 'RenderTooLarge', 'ToolSpec',
|
|
6
|
+
'AgentError', 'AgentView', 'Context', 'Image', 'RenderTooLarge', 'ToolSpec',
|
|
7
7
|
'agent_view', 'operation', 'strategy_tool',
|
|
8
8
|
]
|
|
@@ -20,23 +20,34 @@ class ToolSpec:
|
|
|
20
20
|
bind: Optional[str] = None
|
|
21
21
|
schema: Optional[dict] = None
|
|
22
22
|
fn: Optional[Callable] = None
|
|
23
|
+
from_shell: bool = False
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def strategy_tool(
|
|
26
27
|
strategy: str, takes_target: bool = True, bind: Optional[str] = None,
|
|
27
|
-
name: Optional[str] = None, description: Optional[str] = None,
|
|
28
|
+
name: Optional[str] = None, description: Optional[str] = None, from_shell: bool = False,
|
|
28
29
|
) -> ToolSpec:
|
|
29
30
|
"""A view tool that runs the registered strategy named `strategy`. The agent
|
|
30
31
|
supplies its target; `takes_target=False` runs it untargeted, and `bind`
|
|
31
|
-
fixes the target to an entity id.
|
|
32
|
+
fixes the target to an entity id. With `from_shell`, calling it runs nothing:
|
|
33
|
+
it returns a strategy token the agent's shell runs the strategy with, for
|
|
34
|
+
params too large to pass through the conversation, such as a file's bytes."""
|
|
32
35
|
return ToolSpec(
|
|
33
36
|
name=name or _tool_name(strategy), description=description, strategy=strategy,
|
|
34
|
-
takes_target=takes_target, bind=bind,
|
|
37
|
+
takes_target=takes_target, bind=bind, from_shell=from_shell,
|
|
35
38
|
)
|
|
36
39
|
|
|
37
40
|
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class Image:
|
|
43
|
+
"""An image an operation returns for the agent to look at: its encoded bytes and media type."""
|
|
44
|
+
data: bytes
|
|
45
|
+
media_type: str
|
|
46
|
+
|
|
47
|
+
|
|
38
48
|
def operation(name: str, description: str, schema: dict) -> Callable[[Callable], ToolSpec]:
|
|
39
|
-
"""A view tool that is code: `async def fn(ctx, **params)`.
|
|
49
|
+
"""A view tool that is code: `async def fn(ctx, **params)`. It returns JSON values, an
|
|
50
|
+
`Image`, or a list mixing the two."""
|
|
40
51
|
def wrap(fn: Callable) -> ToolSpec:
|
|
41
52
|
return ToolSpec(name=name, description=description, schema=schema, fn=fn, takes_target=False)
|
|
42
53
|
return wrap
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
the same `default_for` type, replaces the one here, and may reuse these parts."""
|
|
3
3
|
from graphcore.agent_frontend.base.views import (
|
|
4
4
|
children_section, deployment_tools, entity_fields, entity_summary, entity_view, grouped,
|
|
5
|
-
home_view,
|
|
5
|
+
home_view, routes_section, type_tools, view_tools, view_view,
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
9
9
|
'children_section', 'deployment_tools', 'entity_fields', 'entity_summary', 'entity_view',
|
|
10
|
-
'grouped', 'home_view', '
|
|
10
|
+
'grouped', 'home_view', 'routes_section', 'type_tools', 'view_tools', 'view_view',
|
|
11
11
|
]
|
|
@@ -101,20 +101,15 @@ async def deployment_tools(ctx: Context, entity: Optional[Any] = None) -> list[T
|
|
|
101
101
|
return [strategy_tool(s['name'], takes_target=False) for s in ctx.deployment_strategies()]
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def
|
|
105
|
-
"""`##
|
|
104
|
+
def routes_section(ctx: Context) -> list:
|
|
105
|
+
"""`## Routes` and a compact placement per route other than `/` that needs no entity."""
|
|
106
106
|
paths = [r['pattern'] for r in ctx.routes() if r['pattern'] != '/' and '{' not in r['pattern']]
|
|
107
|
-
return ['##
|
|
107
|
+
return ['## Routes', *(ctx.place(path) for path in paths)] if paths else []
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
@agent_view('home', tools=deployment_tools)
|
|
111
111
|
async def home_view(ctx: Context) -> list:
|
|
112
|
-
|
|
113
|
-
return [
|
|
114
|
-
*places(ctx),
|
|
115
|
-
"## Top-level entities\nOpen one to see what it contains.",
|
|
116
|
-
*grouped(ctx, top_level),
|
|
117
|
-
]
|
|
112
|
+
return routes_section(ctx)
|
|
118
113
|
|
|
119
114
|
|
|
120
115
|
@agent_view('entity', tools=type_tools)
|
|
@@ -23,6 +23,9 @@ class GraphClient(Protocol):
|
|
|
23
23
|
async def execute(
|
|
24
24
|
self, principal: Principal, strategy_name: str, target_id: Optional[str], params: dict,
|
|
25
25
|
) -> dict: ...
|
|
26
|
+
async def issue_strategy_token(
|
|
27
|
+
self, principal: Principal, strategy_name: str, target_id: str,
|
|
28
|
+
) -> tuple[str, float]: ...
|
|
26
29
|
def resolve(self, address: str) -> dict: ...
|
|
27
30
|
def routes(self) -> list[dict]: ...
|
|
28
31
|
def entity_types(self) -> list[str]: ...
|
|
@@ -54,7 +54,7 @@ class Reads:
|
|
|
54
54
|
class Context:
|
|
55
55
|
def __init__(
|
|
56
56
|
self, principal: Principal, address: str, entity: Any, client: GraphClient, reads: Reads,
|
|
57
|
-
registry: Optional[AgentRegistry] = None, query_max: int = DEFAULT_QUERY_MAX,
|
|
57
|
+
registry: Optional[AgentRegistry] = None, query_max: int = DEFAULT_QUERY_MAX, web_base: str = '',
|
|
58
58
|
):
|
|
59
59
|
self.principal = principal
|
|
60
60
|
self.address = address
|
|
@@ -66,6 +66,7 @@ class Context:
|
|
|
66
66
|
self._reads = reads
|
|
67
67
|
self._registry = registry
|
|
68
68
|
self._query_max = query_max
|
|
69
|
+
self._web_base = web_base
|
|
69
70
|
|
|
70
71
|
def _record(self, entity: Any) -> None:
|
|
71
72
|
self._reads.seen[entity.entity_id] = f"v{entity.version}"
|
|
@@ -129,6 +130,11 @@ class Context:
|
|
|
129
130
|
self.more = cursor is not None
|
|
130
131
|
return found
|
|
131
132
|
|
|
133
|
+
def web_url(self, target: str) -> Optional[str]:
|
|
134
|
+
"""The web app's URL for an address or entity id: `GRAPHCORE_WEB_URL` plus its
|
|
135
|
+
address, or None when the deployment sets no web URL."""
|
|
136
|
+
return self._web_base + to_address(target) if self._web_base else None
|
|
137
|
+
|
|
132
138
|
def view(self, name: str) -> Optional[AgentView]:
|
|
133
139
|
"""The agent view registered as `name`: an app's, else the base one."""
|
|
134
140
|
return self._registry.by_name(name) if self._registry and name else None
|
|
@@ -23,6 +23,11 @@ class Frontend:
|
|
|
23
23
|
registry: AgentRegistry
|
|
24
24
|
max_chars: int = int(os.environ.get('GRAPHCORE_AGENT_RENDER_MAX_CHARS', DEFAULT_MAX_CHARS))
|
|
25
25
|
query_max: int = int(os.environ.get('GRAPHCORE_AGENT_QUERY_MAX', DEFAULT_QUERY_MAX))
|
|
26
|
+
# The web app's URL with its base path (`GRAPHCORE_WEB_URL`); empty when there is none.
|
|
27
|
+
web_url: str = ''
|
|
28
|
+
|
|
29
|
+
def __post_init__(self) -> None:
|
|
30
|
+
self.web_url = self.web_url.rstrip('/')
|
|
26
31
|
|
|
27
32
|
|
|
28
33
|
@dataclass
|
|
@@ -115,10 +120,12 @@ async def _tools(fe: Frontend, ctx: Context, view: AgentView, entity: Any) -> li
|
|
|
115
120
|
}:
|
|
116
121
|
continue
|
|
117
122
|
strategy = info[spec.strategy]
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
if spec.from_shell:
|
|
124
|
+
description = f"A token to run this from your shell: {strategy.get('description')}"
|
|
125
|
+
schema = {'type': 'object', 'properties': {}}
|
|
126
|
+
else:
|
|
127
|
+
description, schema = strategy.get('description'), strategy.get('schema') or {}
|
|
128
|
+
tool = ResolvedTool(spec.name, spec.description or _one_line(description), schema, spec)
|
|
122
129
|
resolved.setdefault(tool.name, tool)
|
|
123
130
|
return list(resolved.values())
|
|
124
131
|
|
|
@@ -177,7 +184,7 @@ async def _render_body(
|
|
|
177
184
|
resolved = fe.client.resolve(address)
|
|
178
185
|
except NotFound:
|
|
179
186
|
raise AgentError('NotFound', f"no route matches {address!r}; start from open('/')")
|
|
180
|
-
ctx = Context(principal, address, None, fe.client, reads, fe.registry, fe.query_max)
|
|
187
|
+
ctx = Context(principal, address, None, fe.client, reads, fe.registry, fe.query_max, fe.web_url)
|
|
181
188
|
view, entity = await _choose(fe, ctx, resolved['view_name'], resolved['entity_id'])
|
|
182
189
|
ctx.entity = entity
|
|
183
190
|
result = await (view.fn(ctx, entity) if entity is not None else view.fn(ctx))
|
|
@@ -196,7 +203,8 @@ async def render(fe: Frontend, principal: Principal, address: str) -> Rendered:
|
|
|
196
203
|
reads = Reads()
|
|
197
204
|
body = await _render_body(fe, principal, address, reads, with_tools=True)
|
|
198
205
|
version = reads.version()
|
|
199
|
-
|
|
206
|
+
web = f"web: {fe.web_url}{address} · " if fe.web_url else ''
|
|
207
|
+
out = [f"# {body.title}", f"address: {address} · {web}version: {version}"]
|
|
200
208
|
if body.text:
|
|
201
209
|
out.append('\n' + body.text)
|
|
202
210
|
if body.tools:
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""The MCP endpoint: four fixed tools over a `Frontend`, stateless, bearer-authenticated."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import base64
|
|
5
|
+
from typing import Annotated, Any, Callable, Optional, Sequence
|
|
5
6
|
|
|
6
7
|
from mcp.server.mcpserver import Context, MCPServer
|
|
7
8
|
from mcp.server.mcpserver.exceptions import ToolError
|
|
8
9
|
from mcp.server.transport_security import TransportSecuritySettings
|
|
10
|
+
from mcp_types import CallToolResult, ImageContent, TextContent
|
|
9
11
|
from starlette.middleware.cors import CORSMiddleware
|
|
10
12
|
from starlette.responses import JSONResponse
|
|
11
13
|
|
|
@@ -25,6 +27,10 @@ Every place is a Markdown page: its content, its address, a version, and a Tools
|
|
|
25
27
|
- act(strategy, target, params): run a strategy directly when no place lists it as a tool.
|
|
26
28
|
Reads and writes run as the user whose token you connected with.
|
|
27
29
|
"""
|
|
30
|
+
WEB_INSTRUCTIONS = """\
|
|
31
|
+
A place's `web:` link opens the same place in the web app. Give it to the user when
|
|
32
|
+
they need to do something there.
|
|
33
|
+
"""
|
|
28
34
|
|
|
29
35
|
|
|
30
36
|
def _principal(ctx: Context):
|
|
@@ -62,11 +68,14 @@ class _BearerAuth:
|
|
|
62
68
|
|
|
63
69
|
def create_app(
|
|
64
70
|
client: GraphClient, registry: AgentRegistry, path: str = '/mcp', allowed_origins: Sequence[str] = (),
|
|
65
|
-
challenge: Callable[[dict], str] = lambda scope: 'Bearer',
|
|
71
|
+
challenge: Callable[[dict], str] = lambda scope: 'Bearer', web_url: str = '',
|
|
72
|
+
execute_url: Callable[[dict], str] = lambda scope: '',
|
|
66
73
|
):
|
|
67
|
-
"""``challenge`` builds the 401's ``WWW-Authenticate`` value from the ASGI scope
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
"""``challenge`` builds the 401's ``WWW-Authenticate`` value from the ASGI scope;
|
|
75
|
+
``web_url`` is the web app's URL, which every render then links to;
|
|
76
|
+
``execute_url`` builds, from the ASGI scope, the URL a strategy token's requests go to."""
|
|
77
|
+
fe = Frontend(client, registry, web_url=web_url)
|
|
78
|
+
mcp = MCPServer('graphcore', instructions=INSTRUCTIONS + (WEB_INSTRUCTIONS if web_url else ''))
|
|
70
79
|
|
|
71
80
|
@mcp.tool(description='Read a place. Returns Markdown with its address, version and Tools.')
|
|
72
81
|
async def open(at: str, ctx: Context, version: Optional[str] = None) -> str:
|
|
@@ -80,8 +89,19 @@ def create_app(
|
|
|
80
89
|
async def call(
|
|
81
90
|
at: str, tool: str, ctx: Context, params: Optional[dict[str, Any]] = None,
|
|
82
91
|
seen_version: Optional[str] = None,
|
|
83
|
-
) -> str:
|
|
84
|
-
|
|
92
|
+
) -> Annotated[CallToolResult, str]:
|
|
93
|
+
# Annotated with `str` so the output schema and structured content stay what a `-> str` tool's are.
|
|
94
|
+
out = await _guard(tools.call)(
|
|
95
|
+
fe, _principal(ctx), at, tool, params, seen_version, execute_url(ctx.request_context.request.scope),
|
|
96
|
+
)
|
|
97
|
+
return CallToolResult(
|
|
98
|
+
content=[
|
|
99
|
+
TextContent(type='text', text=out.text),
|
|
100
|
+
*(ImageContent(type='image', data=base64.b64encode(i.data).decode(), mime_type=i.media_type)
|
|
101
|
+
for i in out.images),
|
|
102
|
+
],
|
|
103
|
+
structured_content={'result': out.text},
|
|
104
|
+
)
|
|
85
105
|
|
|
86
106
|
@mcp.tool(description='Run a strategy by name, optionally on a target address or entity id.')
|
|
87
107
|
async def act(strategy: str, ctx: Context, target: Optional[str] = None, params: Optional[dict[str, Any]] = None) -> str:
|
|
@@ -40,6 +40,7 @@ async def open_place(fe: Frontend, principal: Principal, at: str) -> Place:
|
|
|
40
40
|
|
|
41
41
|
async def call_tool(
|
|
42
42
|
fe: Frontend, principal: Principal, at: str, tool: str, params: Optional[dict] = None,
|
|
43
|
-
seen_version: Optional[str] = None,
|
|
43
|
+
seen_version: Optional[str] = None, execute_url: str = '',
|
|
44
44
|
) -> dict:
|
|
45
|
-
|
|
45
|
+
out = await tools.call(fe, principal, to_address(at), tool, params, seen_version, execute_url)
|
|
46
|
+
return {**json.loads(out.text), 'images': list(out.images)}
|
|
@@ -44,6 +44,7 @@ class FakeGraphClient:
|
|
|
44
44
|
self.by_type = {'t.Note': ['Rename'], 't.Folder': []}
|
|
45
45
|
self.deployment = ['CreateNote']
|
|
46
46
|
self.executed: list[tuple] = []
|
|
47
|
+
self.tokens: list[tuple] = []
|
|
47
48
|
self.tombstones: set[str] = set()
|
|
48
49
|
self.granted: set[str] = set()
|
|
49
50
|
self.pages_listed = 0
|
|
@@ -96,6 +97,12 @@ class FakeGraphClient:
|
|
|
96
97
|
e.version += 1
|
|
97
98
|
return {'status': 'completed', 'ret_val': {'ok': True}}
|
|
98
99
|
|
|
100
|
+
async def issue_strategy_token(self, principal, strategy_name, target_id):
|
|
101
|
+
if target_id not in self.entities:
|
|
102
|
+
raise NotFound(target_id)
|
|
103
|
+
self.tokens.append((strategy_name, target_id))
|
|
104
|
+
return f'gcst.{strategy_name}', 1_800_000_000.0
|
|
105
|
+
|
|
99
106
|
def resolve(self, address):
|
|
100
107
|
if address in ('/', ''):
|
|
101
108
|
return {'view_name': 'home', 'entity_id': None}
|
{graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/test_frontend.py
RENAMED
|
@@ -4,7 +4,7 @@ import subprocess
|
|
|
4
4
|
import sys
|
|
5
5
|
import unittest
|
|
6
6
|
|
|
7
|
-
from graphcore.agent_frontend import agent_view, operation, strategy_tool
|
|
7
|
+
from graphcore.agent_frontend import Image, agent_view, operation, strategy_tool
|
|
8
8
|
from graphcore.agent_frontend.api import AgentView, view_of
|
|
9
9
|
from graphcore.agent_frontend.base.views import MAX_FIELD_CHARS
|
|
10
10
|
from graphcore.agent_frontend.errors import AgentError, RenderTooLarge
|
|
@@ -12,10 +12,17 @@ from graphcore.agent_frontend.loading import load_registry
|
|
|
12
12
|
from graphcore.agent_frontend.registry import AgentRegistry
|
|
13
13
|
from graphcore.agent_frontend.render import Frontend, render
|
|
14
14
|
from graphcore.agent_frontend import tools
|
|
15
|
+
from graphcore.agent_frontend.testing import call_tool, open_place
|
|
15
16
|
from graphcore.agent_frontend.tests.fakes import PRINCIPAL, FakeEntity, FakeGraphClient
|
|
16
17
|
from graphcore.types.query import ContainsValue
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
PNG = bytes.fromhex(
|
|
21
|
+
'89504e470d0a1a0a0000000d4948445200000001000000010806000000'
|
|
22
|
+
'1f15c4890000000d49444154789c6360000002000001e221bc330000000049454e44ae426082'
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
19
26
|
def run(coro):
|
|
20
27
|
return asyncio.run(coro)
|
|
21
28
|
|
|
@@ -100,12 +107,33 @@ class FrontendTests(unittest.TestCase):
|
|
|
100
107
|
f"long: {'x' * MAX_FIELD_CHARS}… (truncated; {MAX_FIELD_CHARS + 1} characters)"):
|
|
101
108
|
self.assertIn(line, text)
|
|
102
109
|
|
|
103
|
-
def
|
|
110
|
+
def test_home_lists_only_routes(self):
|
|
104
111
|
text = run(render(self.fe, PRINCIPAL, '/')).text
|
|
105
|
-
self.assertIn('##
|
|
112
|
+
self.assertIn('## Routes\n\n- notes.index · /notes', text)
|
|
106
113
|
self.assertNotIn('/notes/{entity}', text)
|
|
107
|
-
self.
|
|
108
|
-
self.
|
|
114
|
+
self.assertNotIn('Top-level entities', text)
|
|
115
|
+
self.assertNotIn('/e/b/1', text)
|
|
116
|
+
|
|
117
|
+
def test_header_links_every_place_to_the_web_app(self):
|
|
118
|
+
fe = Frontend(self.client, self.registry, max_chars=5000, web_url='http://localhost:3000/app/')
|
|
119
|
+
entity = run(open_place(fe, PRINCIPAL, '/e/b/1'))
|
|
120
|
+
self.assertIn('address: /e/b/1 · web: http://localhost:3000/app/e/b/1 · version: ', entity.text)
|
|
121
|
+
self.assertIn('web: http://localhost:3000/app/ · ', run(open_place(fe, PRINCIPAL, '/')).text)
|
|
122
|
+
|
|
123
|
+
def test_header_has_no_web_link_without_a_web_url(self):
|
|
124
|
+
text = run(open_place(self.fe, PRINCIPAL, '/e/b/1')).text
|
|
125
|
+
self.assertNotIn('web:', text)
|
|
126
|
+
self.assertIn('address: /e/b/1 · version: ', text)
|
|
127
|
+
|
|
128
|
+
def test_views_build_web_links(self):
|
|
129
|
+
@agent_view('notes.index')
|
|
130
|
+
async def notes_index(ctx):
|
|
131
|
+
return [f"{ctx.web_url('/notes')} {ctx.web_url('gc://b/2')}"]
|
|
132
|
+
self.registry.add(view_of(notes_index))
|
|
133
|
+
fe = Frontend(self.client, self.registry, max_chars=5000, web_url='http://localhost:3000/app')
|
|
134
|
+
self.assertIn('http://localhost:3000/app/notes http://localhost:3000/app/e/b/2',
|
|
135
|
+
run(render(fe, PRINCIPAL, '/notes')).text)
|
|
136
|
+
self.assertIn('None None', run(render(self.fe, PRINCIPAL, '/notes')).text)
|
|
109
137
|
|
|
110
138
|
def test_tools_by_policy(self):
|
|
111
139
|
r = run(render(self.fe, PRINCIPAL, '/e/b/2'))
|
|
@@ -331,9 +359,10 @@ class ToolTests(unittest.TestCase):
|
|
|
331
359
|
def test_call_runs_strategy_and_returns_new_version(self):
|
|
332
360
|
r = run(render(self.fe, PRINCIPAL, '/e/b/2'))
|
|
333
361
|
out = run(tools.call(self.fe, PRINCIPAL, '/e/b/2', 'rename', {'name': 'X'}, r.version))
|
|
334
|
-
self.assertIn('"ok":true', out)
|
|
362
|
+
self.assertIn('"ok":true', out.text)
|
|
363
|
+
self.assertEqual(out.images, ())
|
|
335
364
|
self.assertIn(('Rename', 'gc://b/2', {'name': 'X'}), self.client.executed)
|
|
336
|
-
self.assertNotIn(r.version, out)
|
|
365
|
+
self.assertNotIn(r.version, out.text)
|
|
337
366
|
|
|
338
367
|
def test_stale(self):
|
|
339
368
|
with self.assertRaises(AgentError) as cm:
|
|
@@ -367,7 +396,40 @@ class ToolTests(unittest.TestCase):
|
|
|
367
396
|
reg.add(view_of(v))
|
|
368
397
|
fe = Frontend(self.client, reg)
|
|
369
398
|
out = run(tools.call(fe, PRINCIPAL, '/e/b/2', 'ping', {}))
|
|
370
|
-
self.assertIn('pong', out)
|
|
399
|
+
self.assertIn('pong', out.text)
|
|
400
|
+
|
|
401
|
+
def _with_operation(self, returns):
|
|
402
|
+
@operation('look', 'Look', {'type': 'object', 'properties': {}})
|
|
403
|
+
async def look(ctx):
|
|
404
|
+
return returns
|
|
405
|
+
|
|
406
|
+
async def view_tools(ctx, entity):
|
|
407
|
+
return [look]
|
|
408
|
+
|
|
409
|
+
@agent_view('x.look', default_for=['t.Note'], tools=view_tools)
|
|
410
|
+
async def v(ctx, entity):
|
|
411
|
+
return []
|
|
412
|
+
reg = load_registry([])
|
|
413
|
+
reg.add(view_of(v))
|
|
414
|
+
return Frontend(self.client, reg)
|
|
415
|
+
|
|
416
|
+
def test_an_operation_returns_an_image(self):
|
|
417
|
+
png = Image(PNG, 'image/png')
|
|
418
|
+
out = run(call_tool(self._with_operation(png), PRINCIPAL, '/e/b/2', 'look'))
|
|
419
|
+
self.assertEqual(out['result'], {'image': 'image/png', 'bytes': len(PNG)})
|
|
420
|
+
self.assertEqual(out['images'], [png])
|
|
421
|
+
self.assertEqual(out['images'][0].data, PNG)
|
|
422
|
+
|
|
423
|
+
def test_an_operation_returns_a_caption_and_an_image(self):
|
|
424
|
+
png = Image(PNG, 'image/png')
|
|
425
|
+
out = run(call_tool(self._with_operation(['caption', png]), PRINCIPAL, '/e/b/2', 'look'))
|
|
426
|
+
self.assertEqual(out['result'], ['caption', {'image': 'image/png', 'bytes': len(PNG)}])
|
|
427
|
+
self.assertEqual(out['images'], [png])
|
|
428
|
+
|
|
429
|
+
def test_an_operation_returning_a_dict_returns_no_images(self):
|
|
430
|
+
out = run(call_tool(self._with_operation({'pong': True}), PRINCIPAL, '/e/b/2', 'look'))
|
|
431
|
+
self.assertEqual(out['result'], {'pong': True})
|
|
432
|
+
self.assertEqual(out['images'], [])
|
|
371
433
|
|
|
372
434
|
def test_a_tool_that_deletes_its_own_place_succeeds(self):
|
|
373
435
|
@operation('discard', 'Discard', {'type': 'object', 'properties': {}})
|
|
@@ -384,7 +446,7 @@ class ToolTests(unittest.TestCase):
|
|
|
384
446
|
reg = load_registry([])
|
|
385
447
|
reg.add(view_of(v))
|
|
386
448
|
fe = Frontend(self.client, reg)
|
|
387
|
-
out = json.loads(run(tools.call(fe, PRINCIPAL, '/e/b/2', 'discard', {})))
|
|
449
|
+
out = json.loads(run(tools.call(fe, PRINCIPAL, '/e/b/2', 'discard', {})).text)
|
|
388
450
|
self.assertEqual(out['result'], {'deleted': True})
|
|
389
451
|
self.assertTrue(out['ok'])
|
|
390
452
|
self.assertIsNone(out['address'])
|
|
@@ -430,6 +492,45 @@ class ToolTests(unittest.TestCase):
|
|
|
430
492
|
run(tools.call(fe, PRINCIPAL, '/e/b/2', 'rename_this', {'name': 'X'}))
|
|
431
493
|
self.assertIn(('Rename', 'gc://b/2', {'name': 'X'}), self.client.executed)
|
|
432
494
|
|
|
495
|
+
def _attach_view(self):
|
|
496
|
+
self.client.strategies['Attach'] = {
|
|
497
|
+
'description': 'Attach a file',
|
|
498
|
+
'schema': {'type': 'object', 'properties': {
|
|
499
|
+
'data': {'type': 'string'}, 'name': {'type': 'string'}, 'note': {'type': 'string'}}, 'required': ['data']}}
|
|
500
|
+
self.client.by_type['t.Note'].append('Attach')
|
|
501
|
+
|
|
502
|
+
async def attach(ctx, entity):
|
|
503
|
+
return [strategy_tool('Attach', bind=entity.entity_id, name='attach_files', from_shell=True)]
|
|
504
|
+
|
|
505
|
+
@agent_view('x.attach', default_for=['t.Note'], tools=attach)
|
|
506
|
+
async def v(ctx, entity):
|
|
507
|
+
return []
|
|
508
|
+
reg = load_registry([])
|
|
509
|
+
reg.add(view_of(v))
|
|
510
|
+
return Frontend(self.client, reg)
|
|
511
|
+
|
|
512
|
+
def test_a_from_shell_tool_is_listed_without_params(self):
|
|
513
|
+
r = run(render(self._attach_view(), PRINCIPAL, '/e/b/2'))
|
|
514
|
+
self.assertEqual(r.tools[0].signature, 'attach_files() — A token to run this from your shell: Attach a file')
|
|
515
|
+
|
|
516
|
+
def test_calling_a_from_shell_tool_returns_a_token_and_runs_nothing(self):
|
|
517
|
+
url = 'https://h/graphcore/api/execute_strategy_req/'
|
|
518
|
+
out = json.loads(run(tools.call(self._attach_view(), PRINCIPAL, '/e/b/2', 'attach_files', {}, execute_url=url)).text)
|
|
519
|
+
result = out['result']
|
|
520
|
+
self.assertEqual((result['url'], result['token']), (url, 'gcst.Attach'))
|
|
521
|
+
self.assertEqual(result['request'], {'await_response': True, 'strategy': {
|
|
522
|
+
'strategy_name': 'Attach', 'target_entity_id': 'gc://b/2', 'param_config': {}}})
|
|
523
|
+
self.assertEqual(result['schema'], self.client.strategies['Attach']['schema'])
|
|
524
|
+
self.assertIn("Bearer gcst.Attach", result['how'])
|
|
525
|
+
self.assertEqual(self.client.tokens, [('Attach', 'gc://b/2')])
|
|
526
|
+
self.assertEqual(self.client.executed, [])
|
|
527
|
+
|
|
528
|
+
def test_a_token_needs_somewhere_to_send_files(self):
|
|
529
|
+
with self.assertRaises(AgentError) as cm:
|
|
530
|
+
run(tools.call(self._attach_view(), PRINCIPAL, '/e/b/2', 'attach_files', {}))
|
|
531
|
+
self.assertEqual(cm.exception.code, 'Unavailable')
|
|
532
|
+
self.assertEqual(self.client.tokens, [])
|
|
533
|
+
|
|
433
534
|
def test_find_short_type_and_predicate(self):
|
|
434
535
|
out = run(tools.find(self.fe, PRINCIPAL, 'Note', {'title': 'Hello'}))
|
|
435
536
|
self.assertIn('Hello · t.Note · /e/b/2', out)
|
{graphcore_kernel-0.1.0 → graphcore_kernel-0.2.1}/graphcore/agent_frontend/tests/test_server.py
RENAMED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
from contextlib import asynccontextmanager
|
|
2
3
|
|
|
3
4
|
import httpx2
|
|
4
5
|
from django.test import SimpleTestCase
|
|
5
6
|
|
|
7
|
+
from graphcore.agent_frontend import Image, agent_view, operation
|
|
8
|
+
from graphcore.agent_frontend.api import view_of
|
|
9
|
+
from graphcore.agent_frontend.loading import load_registry
|
|
6
10
|
from graphcore.agent_frontend.registry import AgentRegistry
|
|
7
11
|
from graphcore.agent_frontend.server import create_app
|
|
8
12
|
from graphcore.agent_frontend.tests.fakes import FakeEntity, FakeGraphClient
|
|
9
13
|
|
|
14
|
+
PNG = b'\x89PNG\r\n\x1a\nnot really'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@operation('look', 'Look', {'type': 'object', 'properties': {}})
|
|
18
|
+
async def look(ctx):
|
|
19
|
+
return ['caption', Image(PNG, 'image/png')]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def note_tools(ctx, entity):
|
|
23
|
+
return [look]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@agent_view('x.look', default_for=['t.Note'], tools=note_tools)
|
|
27
|
+
async def note(ctx, entity):
|
|
28
|
+
return []
|
|
29
|
+
|
|
30
|
+
|
|
10
31
|
HEADERS = {'Accept': 'application/json, text/event-stream', 'Content-Type': 'application/json'}
|
|
11
32
|
|
|
12
33
|
|
|
13
34
|
class McpServerTests(SimpleTestCase):
|
|
14
35
|
@asynccontextmanager
|
|
15
|
-
async def serving(self, allowed_origins=(), **kwargs):
|
|
36
|
+
async def serving(self, allowed_origins=(), registry=None, **kwargs):
|
|
16
37
|
self.graph = FakeGraphClient()
|
|
17
38
|
self.graph.add(FakeEntity('gc://b/1', 't.Note', fields={'title': 'Hello'}))
|
|
18
|
-
app = create_app(self.graph, AgentRegistry(), allowed_origins=allowed_origins, **kwargs)
|
|
39
|
+
app = create_app(self.graph, registry or AgentRegistry(), allowed_origins=allowed_origins, **kwargs)
|
|
19
40
|
self._id = 0
|
|
20
41
|
# The session manager's task group must enter and exit in one task, so no asyncSetUp.
|
|
21
42
|
async with app.mcp_app.router.lifespan_context(app.mcp_app):
|
|
@@ -61,6 +82,20 @@ class McpServerTests(SimpleTestCase):
|
|
|
61
82
|
tools = (await self.rpc('tools/list')).json()['result']['tools']
|
|
62
83
|
self.assertEqual({t['name'] for t in tools}, {'open', 'find', 'call', 'act'})
|
|
63
84
|
|
|
85
|
+
async def initialize(self):
|
|
86
|
+
init = await self.rpc('initialize', {
|
|
87
|
+
'protocolVersion': '2025-06-18', 'capabilities': {}, 'clientInfo': {'name': 't', 'version': '0'},
|
|
88
|
+
})
|
|
89
|
+
return init.json()['result']
|
|
90
|
+
|
|
91
|
+
async def test_instructions_name_the_web_link_only_with_a_web_url(self):
|
|
92
|
+
async with self.serving(web_url='http://localhost:3000/app'):
|
|
93
|
+
self.assertIn('`web:` link', (await self.initialize())['instructions'])
|
|
94
|
+
result = await self.call_tool('open', {'at': '/e/b/1'})
|
|
95
|
+
self.assertIn('web: http://localhost:3000/app/e/b/1', result['content'][0]['text'])
|
|
96
|
+
async with self.serving():
|
|
97
|
+
self.assertNotIn('web:', (await self.initialize())['instructions'])
|
|
98
|
+
|
|
64
99
|
async def test_open_root(self):
|
|
65
100
|
async with self.serving():
|
|
66
101
|
result = await self.call_tool('open', {'at': '/'})
|
|
@@ -81,6 +116,24 @@ class McpServerTests(SimpleTestCase):
|
|
|
81
116
|
self.assertIn('stale', result['content'][0]['text'].lower())
|
|
82
117
|
self.assertEqual(self.graph.executed, [])
|
|
83
118
|
|
|
119
|
+
async def test_call_of_an_image_operation_returns_text_then_image(self):
|
|
120
|
+
registry = load_registry([])
|
|
121
|
+
registry.add(view_of(note))
|
|
122
|
+
async with self.serving(registry=registry):
|
|
123
|
+
result = await self.call_tool('call', {'at': '/e/b/1', 'tool': 'look'})
|
|
124
|
+
self.assertFalse(result.get('isError'))
|
|
125
|
+
text, image = result['content']
|
|
126
|
+
self.assertEqual(text['type'], 'text')
|
|
127
|
+
self.assertIn('"bytes":%d' % len(PNG), text['text'])
|
|
128
|
+
self.assertEqual(image, {'type': 'image', 'mimeType': 'image/png', 'data': base64.b64encode(PNG).decode()})
|
|
129
|
+
|
|
130
|
+
async def test_call_of_a_strategy_tool_returns_one_text_block(self):
|
|
131
|
+
async with self.serving(registry=load_registry([])):
|
|
132
|
+
result = await self.call_tool('call', {'at': '/e/b/1', 'tool': 'rename', 'params': {'name': 'x'}})
|
|
133
|
+
self.assertFalse(result.get('isError'))
|
|
134
|
+
self.assertEqual([c['type'] for c in result['content']], ['text'])
|
|
135
|
+
self.assertEqual(result['structuredContent'], {'result': result['content'][0]['text']})
|
|
136
|
+
|
|
84
137
|
async def test_answers_preflight_from_an_allowed_origin_without_a_token(self):
|
|
85
138
|
async with self.serving(allowed_origins=['http://localhost:3000']):
|
|
86
139
|
response = await self.http.options('/mcp', headers={
|