graphcore-kernel 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
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/agent_frontend/api.py +6 -3
- graphcore/agent_frontend/client.py +3 -0
- graphcore/agent_frontend/render.py +6 -4
- graphcore/agent_frontend/server.py +6 -2
- graphcore/agent_frontend/testing.py +2 -2
- graphcore/agent_frontend/tests/fakes.py +7 -0
- graphcore/agent_frontend/tests/test_frontend.py +39 -0
- graphcore/agent_frontend/tools.py +41 -1
- graphcore/api/graph_api.py +6 -0
- graphcore/api/tests/test_strategy_tokens.py +144 -0
- graphcore/auth/authn/README.md +50 -4
- graphcore/auth/authn/strategy_tokens.py +38 -0
- graphcore/docs/AGENT_FRONTEND_TDD.md +18 -0
- graphcore/docs/AUTHORIZATION_TECHNICAL_TDD.md +15 -12
- graphcore/execution/tests/support.py +14 -1
- graphcore/testing/case.py +24 -2
- graphcore/transport/agent_asgi.py +10 -1
- graphcore/transport/agent_client.py +15 -3
- graphcore/transport/views.py +7 -3
- graphcore/types/strategy.py +11 -0
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/METADATA +1 -1
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/RECORD +27 -25
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/WHEEL +0 -0
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/entry_points.txt +0 -0
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/licenses/LICENSE +0 -0
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/licenses/NOTICE +0 -0
- {graphcore_kernel-0.2.0.dist-info → graphcore_kernel-0.2.1.dist-info}/top_level.txt +0 -0
graphcore/agent_frontend/api.py
CHANGED
|
@@ -20,18 +20,21 @@ 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
|
|
|
@@ -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]: ...
|
|
@@ -120,10 +120,12 @@ async def _tools(fe: Frontend, ctx: Context, view: AgentView, entity: Any) -> li
|
|
|
120
120
|
}:
|
|
121
121
|
continue
|
|
122
122
|
strategy = info[spec.strategy]
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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)
|
|
127
129
|
resolved.setdefault(tool.name, tool)
|
|
128
130
|
return list(resolved.values())
|
|
129
131
|
|
|
@@ -69,9 +69,11 @@ class _BearerAuth:
|
|
|
69
69
|
def create_app(
|
|
70
70
|
client: GraphClient, registry: AgentRegistry, path: str = '/mcp', allowed_origins: Sequence[str] = (),
|
|
71
71
|
challenge: Callable[[dict], str] = lambda scope: 'Bearer', web_url: str = '',
|
|
72
|
+
execute_url: Callable[[dict], str] = lambda scope: '',
|
|
72
73
|
):
|
|
73
74
|
"""``challenge`` builds the 401's ``WWW-Authenticate`` value from the ASGI scope;
|
|
74
|
-
``web_url`` is the web app's URL, which every render then links to
|
|
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."""
|
|
75
77
|
fe = Frontend(client, registry, web_url=web_url)
|
|
76
78
|
mcp = MCPServer('graphcore', instructions=INSTRUCTIONS + (WEB_INSTRUCTIONS if web_url else ''))
|
|
77
79
|
|
|
@@ -89,7 +91,9 @@ def create_app(
|
|
|
89
91
|
seen_version: Optional[str] = None,
|
|
90
92
|
) -> Annotated[CallToolResult, str]:
|
|
91
93
|
# Annotated with `str` so the output schema and structured content stay what a `-> str` tool's are.
|
|
92
|
-
out = await _guard(tools.call)(
|
|
94
|
+
out = await _guard(tools.call)(
|
|
95
|
+
fe, _principal(ctx), at, tool, params, seen_version, execute_url(ctx.request_context.request.scope),
|
|
96
|
+
)
|
|
93
97
|
return CallToolResult(
|
|
94
98
|
content=[
|
|
95
99
|
TextContent(type='text', text=out.text),
|
|
@@ -40,7 +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
|
-
out = await tools.call(fe, principal, to_address(at), tool, params, seen_version)
|
|
45
|
+
out = await tools.call(fe, principal, to_address(at), tool, params, seen_version, execute_url)
|
|
46
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}
|
|
@@ -492,6 +492,45 @@ class ToolTests(unittest.TestCase):
|
|
|
492
492
|
run(tools.call(fe, PRINCIPAL, '/e/b/2', 'rename_this', {'name': 'X'}))
|
|
493
493
|
self.assertIn(('Rename', 'gc://b/2', {'name': 'X'}), self.client.executed)
|
|
494
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
|
+
|
|
495
534
|
def test_find_short_type_and_predicate(self):
|
|
496
535
|
out = run(tools.find(self.fe, PRINCIPAL, 'Note', {'title': 'Hello'}))
|
|
497
536
|
self.assertIn('Hello · t.Note · /e/b/2', out)
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
+
from datetime import datetime, timezone
|
|
6
7
|
from typing import Any, Optional
|
|
7
8
|
|
|
8
9
|
import jsonschema
|
|
@@ -85,10 +86,43 @@ async def _target_id(fe: Frontend, target: str) -> str:
|
|
|
85
86
|
return target
|
|
86
87
|
|
|
87
88
|
|
|
89
|
+
async def _strategy_token(
|
|
90
|
+
fe: Frontend, principal: Principal, strategy: str, target: Optional[str], execute_url: str,
|
|
91
|
+
) -> dict:
|
|
92
|
+
"""A strategy token for `strategy` on `target`, and how a shell runs the strategy with it."""
|
|
93
|
+
if not execute_url:
|
|
94
|
+
raise AgentError('Unavailable', "This deployment serves no HTTP API to run strategies from a shell")
|
|
95
|
+
if target is None:
|
|
96
|
+
raise AgentError('InvalidRequest', f"A strategy token runs {strategy} on a target")
|
|
97
|
+
try:
|
|
98
|
+
token, expires_at = await fe.client.issue_strategy_token(principal, strategy, target)
|
|
99
|
+
except InvalidRequest as exc:
|
|
100
|
+
raise AgentError('InvalidRequest', str(exc))
|
|
101
|
+
expires = datetime.fromtimestamp(expires_at, timezone.utc).isoformat(timespec='seconds')
|
|
102
|
+
return {
|
|
103
|
+
'url': execute_url,
|
|
104
|
+
'token': token,
|
|
105
|
+
'expires_at': expires,
|
|
106
|
+
'request': {'await_response': True, 'strategy': {
|
|
107
|
+
'strategy_name': strategy, 'target_entity_id': target, 'param_config': {}}},
|
|
108
|
+
'schema': fe.client.strategy_info()[strategy].get('schema') or {},
|
|
109
|
+
'how': (
|
|
110
|
+
f"From your shell, build `request` with `param_config` as `schema` describes, reading any file it "
|
|
111
|
+
f"takes from disk there, and POST it as JSON to `url` with the header `Authorization: Bearer <token>`, "
|
|
112
|
+
f"once per run: `curl -sS -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' "
|
|
113
|
+
f"--data-binary @request.json '{execute_url}'`. Files go from disk to the deployment, never through "
|
|
114
|
+
f"this conversation. The token runs only {strategy} on {target} and expires at {expires}; call this "
|
|
115
|
+
f"tool again for a new one."
|
|
116
|
+
),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
88
120
|
async def call(
|
|
89
121
|
fe: Frontend, principal: Principal, at: str, tool: str, params: Optional[dict] = None,
|
|
90
|
-
seen_version: Optional[str] = None,
|
|
122
|
+
seen_version: Optional[str] = None, execute_url: str = '',
|
|
91
123
|
) -> CallResult:
|
|
124
|
+
"""`execute_url` is where a shell sends a strategy token's requests: the
|
|
125
|
+
deployment's `execute_strategy_req` as the caller reaches it."""
|
|
92
126
|
params = params or {}
|
|
93
127
|
rendered = await render(fe, principal, at)
|
|
94
128
|
if seen_version is not None and seen_version != rendered.version:
|
|
@@ -114,6 +148,12 @@ async def call(
|
|
|
114
148
|
result = _take_images(await chosen.spec.fn(ctx, **params), images)
|
|
115
149
|
else:
|
|
116
150
|
target = await _target_id(fe, params['target']) if chosen.takes_target else chosen.spec.bind
|
|
151
|
+
if chosen.spec.from_shell:
|
|
152
|
+
result = await _strategy_token(fe, principal, chosen.spec.strategy, target, execute_url)
|
|
153
|
+
return CallResult(_json({
|
|
154
|
+
'ok': True, 'tool': chosen.name, 'result': result, 'address': rendered.address,
|
|
155
|
+
'version': rendered.version, 'note': "nothing ran yet; run it from your shell as `how` says",
|
|
156
|
+
}))
|
|
117
157
|
ctx = Context(principal, rendered.address, rendered.entity, fe.client, Reads(), fe.registry, fe.query_max, fe.web_url)
|
|
118
158
|
result = await ctx.execute(chosen.spec.strategy, target, _strategy_params(chosen, params))
|
|
119
159
|
except NotFound as exc:
|
graphcore/api/graph_api.py
CHANGED
|
@@ -25,6 +25,7 @@ from graphcore.errors import (
|
|
|
25
25
|
)
|
|
26
26
|
from graphcore.types.identity import Principal
|
|
27
27
|
from graphcore.types.api import AccessSummary, StrategyOutcome, StrategyRequestPayload
|
|
28
|
+
from graphcore.types.strategy import StrategyScope
|
|
28
29
|
from graphcore.types.entities import EntityFilter, EntityPage, EntityResult, Tombstone, view_etag
|
|
29
30
|
from graphcore.domain.entity.Entity import Entity
|
|
30
31
|
from graphcore.domain.entity.group.Group import Group
|
|
@@ -107,11 +108,16 @@ class GraphAPI:
|
|
|
107
108
|
payloads: list[StrategyRequestPayload],
|
|
108
109
|
wait: bool = False,
|
|
109
110
|
callback_channel: Optional[str] = None,
|
|
111
|
+
scope: Optional[StrategyScope] = None,
|
|
110
112
|
) -> list[StrategyOutcome]:
|
|
113
|
+
"""With `scope`, the caller may run only what it covers: a payload
|
|
114
|
+
outside it refuses the whole batch."""
|
|
111
115
|
if len(payloads) == 0:
|
|
112
116
|
raise InvalidRequest('strategy list cannot be empty')
|
|
113
117
|
if len(payloads) > self.max_batch_size:
|
|
114
118
|
raise InvalidRequest(f'strategy list exceeds the maximum of {self.max_batch_size}')
|
|
119
|
+
if scope is not None and not all(payload.within(scope) for payload in payloads):
|
|
120
|
+
raise Forbidden(f"This caller may run only {scope.strategy_name} on {scope.target_entity_id}")
|
|
115
121
|
|
|
116
122
|
outcomes: list[StrategyOutcome] = []
|
|
117
123
|
for payload in payloads:
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""Strategy tokens and scopes: a token reads as its principal and a
|
|
2
|
+
`StrategyScope`, `execute_strategies` runs only what the scope covers, as
|
|
3
|
+
that principal with its access at run time, and only `execute_strategy_req`
|
|
4
|
+
accepts a token."""
|
|
5
|
+
import json
|
|
6
|
+
import time
|
|
7
|
+
from unittest.mock import patch
|
|
8
|
+
|
|
9
|
+
from django.core import signing
|
|
10
|
+
from django.test import SimpleTestCase
|
|
11
|
+
|
|
12
|
+
from graphcore.auth.authn import strategy_tokens
|
|
13
|
+
from graphcore.errors import Forbidden, InvalidRequest, NotFound
|
|
14
|
+
from graphcore.execution.tests.support import ExecutionTestCase
|
|
15
|
+
from graphcore.transport import views
|
|
16
|
+
from graphcore.transport.agent_client import InProcessGraphClient
|
|
17
|
+
from graphcore.transport.tests.test_api_views import MockRequest
|
|
18
|
+
from graphcore.types.api import StrategyRequestPayload
|
|
19
|
+
from graphcore.types.identity import Principal
|
|
20
|
+
from graphcore.types.strategy import StrategyScope
|
|
21
|
+
|
|
22
|
+
ALICE = Principal('gc://u/alice')
|
|
23
|
+
SCOPE = StrategyScope('Attach', 'gc://b/probe')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class StrategyTokenTests(SimpleTestCase):
|
|
27
|
+
def test_a_token_reads_back_as_its_principal_and_scope_until_it_expires(self):
|
|
28
|
+
token, expires_at = strategy_tokens.issue(ALICE, SCOPE)
|
|
29
|
+
self.assertTrue(token.startswith('gcst.'))
|
|
30
|
+
self.assertAlmostEqual(expires_at, time.time() + strategy_tokens.LIFETIME_SECONDS, delta=5)
|
|
31
|
+
self.assertEqual(strategy_tokens.read(token), (ALICE, SCOPE))
|
|
32
|
+
with patch('time.time', return_value=time.time() + strategy_tokens.LIFETIME_SECONDS + 1):
|
|
33
|
+
self.assertIsNone(strategy_tokens.read(token))
|
|
34
|
+
|
|
35
|
+
def test_anything_else_reads_as_none(self):
|
|
36
|
+
token, _ = strategy_tokens.issue(ALICE, SCOPE)
|
|
37
|
+
forged = 'gcst.' + signing.dumps({'p': 'gc://u/mallory', 's': 'Attach', 't': 'gc://b/probe'}, salt='other')
|
|
38
|
+
for other in (None, '', token[:-2] + ('AA' if token[-2:] != 'AA' else 'BB'), forged, token[5:], 'eyJhbGciOi.x.y'):
|
|
39
|
+
self.assertIsNone(strategy_tokens.read(other), other)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class StrategyScopeTests(ExecutionTestCase):
|
|
43
|
+
def payload(self, strategy='Attach', target=None, **extra) -> StrategyRequestPayload:
|
|
44
|
+
return StrategyRequestPayload(
|
|
45
|
+
strategy_name=strategy, target_entity_id=target or self.probe.entity_id,
|
|
46
|
+
param_config={'data': 'aGk=', 'name': 'hi.jpg'}, **extra,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def scope(self) -> StrategyScope:
|
|
50
|
+
return StrategyScope('Attach', self.probe.entity_id)
|
|
51
|
+
|
|
52
|
+
async def test_a_scoped_caller_runs_what_its_scope_covers(self):
|
|
53
|
+
await self.seed()
|
|
54
|
+
[outcome] = await self.runtime.graph_api.execute_strategies(
|
|
55
|
+
self.alice, [self.payload()], wait=True, scope=self.scope(),
|
|
56
|
+
)
|
|
57
|
+
self.assertEqual((outcome.status, outcome.ret_val), ('succeeded', {'bytes': 4}))
|
|
58
|
+
request = await self.load(outcome.strategy_request_id)
|
|
59
|
+
self.assertEqual(request.owner, self.alice.principal_entity_id)
|
|
60
|
+
self.assertEqual(request.param_config['data'], {'redacted': True, 'bytes': 4})
|
|
61
|
+
self.assertEqual((await self.load(self.probe.entity_id)).get_attribute('attached'), 'hi.jpg')
|
|
62
|
+
|
|
63
|
+
async def test_a_scoped_caller_runs_nothing_else(self):
|
|
64
|
+
await self.seed()
|
|
65
|
+
scope, other = self.scope(), await self.make_probe(self.alice)
|
|
66
|
+
callback = {'strategy_name': 'Increment', 'target_entity_id': self.probe.entity_id}
|
|
67
|
+
for payload in (
|
|
68
|
+
self.payload('Increment'), self.payload(target=other.entity_id), self.payload(callbacks=[callback]),
|
|
69
|
+
):
|
|
70
|
+
with self.assertRaises(Forbidden):
|
|
71
|
+
await self.runtime.graph_api.execute_strategies(
|
|
72
|
+
self.alice, [self.payload(), payload], wait=True, scope=scope,
|
|
73
|
+
)
|
|
74
|
+
self.assertEqual(await self.requests(), [])
|
|
75
|
+
|
|
76
|
+
async def test_a_token_runs_with_its_principals_access_at_run_time(self):
|
|
77
|
+
await self.seed()
|
|
78
|
+
api = self.runtime.graph_api
|
|
79
|
+
await api.grant(self.alice, self.probe.entity_id, self.bob.principal_entity_id, 'editor')
|
|
80
|
+
token, _ = await InProcessGraphClient(api).issue_strategy_token(self.bob, 'Attach', self.probe.entity_id)
|
|
81
|
+
principal, scope = strategy_tokens.read(token)
|
|
82
|
+
[granted] = await api.execute_strategies(principal, [self.payload()], wait=True, scope=scope)
|
|
83
|
+
await api.revoke(self.alice, self.probe.entity_id, self.bob.principal_entity_id)
|
|
84
|
+
[revoked] = await api.execute_strategies(principal, [self.payload()], wait=True, scope=scope)
|
|
85
|
+
self.assertEqual(granted.status, 'succeeded')
|
|
86
|
+
self.assertEqual((revoked.status, revoked.error_code), ('failed', 'forbidden'))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class IssueStrategyTokenTests(ExecutionTestCase):
|
|
90
|
+
async def test_a_token_is_for_a_strategy_that_runs_on_the_target(self):
|
|
91
|
+
await self.seed()
|
|
92
|
+
client = InProcessGraphClient(self.runtime.graph_api)
|
|
93
|
+
for strategy in ('Untargeted', 'Nope'):
|
|
94
|
+
with self.assertRaises(InvalidRequest):
|
|
95
|
+
await client.issue_strategy_token(self.alice, strategy, self.probe.entity_id)
|
|
96
|
+
|
|
97
|
+
async def test_no_token_for_a_target_the_principal_cannot_read(self):
|
|
98
|
+
await self.seed()
|
|
99
|
+
with self.assertRaises(NotFound):
|
|
100
|
+
await InProcessGraphClient(self.runtime.graph_api).issue_strategy_token(
|
|
101
|
+
self.bob, 'Attach', self.probe.entity_id,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ExecuteWithStrategyTokenViewTests(ExecutionTestCase):
|
|
106
|
+
def setUp(self):
|
|
107
|
+
super().setUp()
|
|
108
|
+
patcher = patch('graphcore.transport.views.get_runtime', return_value=self.runtime)
|
|
109
|
+
patcher.start()
|
|
110
|
+
self.addCleanup(patcher.stop)
|
|
111
|
+
|
|
112
|
+
async def token(self) -> str:
|
|
113
|
+
token, _ = strategy_tokens.issue(self.alice, StrategyScope('Attach', self.probe.entity_id))
|
|
114
|
+
return token
|
|
115
|
+
|
|
116
|
+
async def post(self, token: str, strategy: str = 'Attach'):
|
|
117
|
+
body = {'await_response': True, 'strategy': {
|
|
118
|
+
'strategy_name': strategy, 'target_entity_id': self.probe.entity_id,
|
|
119
|
+
'param_config': {'data': 'aGk=', 'name': 'hi.jpg'}}}
|
|
120
|
+
request = MockRequest(body=json.dumps(body).encode(), headers={'Authorization': f'Bearer {token}'})
|
|
121
|
+
response = await views.api_execute_strategy_req(request)
|
|
122
|
+
return response.status_code, json.loads(response.content)
|
|
123
|
+
|
|
124
|
+
async def test_the_endpoint_runs_what_the_token_covers(self):
|
|
125
|
+
await self.seed()
|
|
126
|
+
status, data = await self.post(await self.token())
|
|
127
|
+
self.assertEqual((status, data['results'][0]['status']), (200, 'succeeded'))
|
|
128
|
+
|
|
129
|
+
async def test_the_endpoint_refuses_what_the_token_does_not_cover(self):
|
|
130
|
+
await self.seed()
|
|
131
|
+
status, _ = await self.post(await self.token(), 'Increment')
|
|
132
|
+
self.assertEqual(status, 403)
|
|
133
|
+
self.assertEqual(await self.requests(), [])
|
|
134
|
+
|
|
135
|
+
async def test_an_invalid_token_is_unauthenticated(self):
|
|
136
|
+
await self.seed()
|
|
137
|
+
status, _ = await self.post('gcst.not-a-token')
|
|
138
|
+
self.assertEqual(status, 401)
|
|
139
|
+
|
|
140
|
+
async def test_no_other_endpoint_accepts_a_strategy_token(self):
|
|
141
|
+
await self.seed()
|
|
142
|
+
request = MockRequest(method='GET', headers={'Authorization': f'Bearer {await self.token()}'})
|
|
143
|
+
response = await views.api_get_entity(request, self.probe.entity_id)
|
|
144
|
+
self.assertEqual(response.status_code, 401)
|
graphcore/auth/authn/README.md
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
How a request becomes a principal. The kernel is an OAuth 2.0 resource
|
|
4
4
|
server and nothing more: it verifies bearer tokens issued by an OIDC
|
|
5
5
|
provider it is configured to trust, and maps each token's subject to a
|
|
6
|
-
`User` of this deployment. It issues no tokens, keeps no passwords,
|
|
7
|
-
shows no login page, and never writes to the issuer.
|
|
6
|
+
`User` of this deployment. It issues no OAuth tokens, keeps no passwords,
|
|
7
|
+
shows no login page, and never writes to the issuer. The one credential it
|
|
8
|
+
signs itself is a strategy token, good for one strategy on one target. Which issuer a
|
|
8
9
|
deployment trusts, and how that issuer is run, is deployment configuration;
|
|
9
10
|
the defaults the distro provides are described in
|
|
10
11
|
`graphcore docs distro/identity-infrastructure`.
|
|
@@ -23,6 +24,7 @@ Authorization, what a principal may do, is a separate subsystem:
|
|
|
23
24
|
| Trusted issuer | One entry of `GRAPHCORE_TRUSTED_ISSUERS`: an issuer this deployment accepts tokens from, with the audience it requires. |
|
|
24
25
|
| Protected resource metadata | RFC 9728: the document at `/.well-known/oauth-protected-resource` naming this deployment's trusted issuers. |
|
|
25
26
|
| Service account | A process an app ships, signing in with a confidential client the app declares (`graphcore_service_clients`). Its principal is a `ServiceAccount`. |
|
|
27
|
+
| Strategy token | A short-lived token the deployment signs, running one strategy on one target as the principal who asked for it. |
|
|
26
28
|
| First contact | The first authenticated request from an `(iss, sub)` this deployment has not seen. It creates the `User`, or binds the `ServiceAccount` of a declared client. |
|
|
27
29
|
|
|
28
30
|
## Configuration
|
|
@@ -138,6 +140,48 @@ Clients start from this document, never from a configured issuer URL:
|
|
|
138
140
|
| `graphcore` CLI | Device authorization grant (RFC 8628); refresh token kept in the deployment's session file |
|
|
139
141
|
| MCP host | 401 → resource metadata → issuer metadata → dynamic client registration (RFC 7591) → code + PKCE |
|
|
140
142
|
|
|
143
|
+
## Strategy tokens
|
|
144
|
+
|
|
145
|
+
A strategy token lets a shell run a strategy without holding the
|
|
146
|
+
principal's own token. An agent connected over MCP has a shell that can
|
|
147
|
+
read the user's files, but the MCP host holds the user's token, and the
|
|
148
|
+
model never sees it. Sending a file through a tool call would mean writing
|
|
149
|
+
its bytes out as text. So the agent asks for a strategy token, and its
|
|
150
|
+
shell posts each request, with the file's bytes in its params, to
|
|
151
|
+
`execute_strategy_req` with it.
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
strategy_tokens.issue(principal, StrategyScope(strategy_name, target_id)) -> (token, expires_at)
|
|
155
|
+
strategy_tokens.read(token) -> (principal, scope) | None
|
|
156
|
+
POST /graphcore/api/execute_strategy_req/ Authorization: Bearer gcst.…
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Like an issuer token, a strategy token stops at the edge: reading one gives
|
|
160
|
+
a principal and a `StrategyScope` (`graphcore.types.strategy`), and the
|
|
161
|
+
kernel sees only those. `GraphAPI.execute_strategies(..., scope=)` runs a
|
|
162
|
+
batch only when every request is within the scope.
|
|
163
|
+
|
|
164
|
+
- An agent gets one by calling a view's `from_shell` tool
|
|
165
|
+
(`graphcore docs distro/agent-views`), for the tool's strategy on a
|
|
166
|
+
target the principal can read and the strategy runs on.
|
|
167
|
+
- The token is `gcst.` followed by `{principal, strategy, target}` signed
|
|
168
|
+
with `SECRET_KEY` (`django.core.signing`). It expires 15 minutes after it
|
|
169
|
+
is issued, and is stored nowhere, so it cannot be revoked before then;
|
|
170
|
+
rotating `SECRET_KEY` invalidates every one.
|
|
171
|
+
- `execute_strategy_req` is the only endpoint that reads one, and it
|
|
172
|
+
passes the scope to `execute_strategies`. Every other endpoint, the MCP
|
|
173
|
+
endpoint and the WebSocket authenticate through `authenticate()`, which
|
|
174
|
+
accepts only issuer tokens, so a strategy token is unauthenticated there.
|
|
175
|
+
A new endpoint accepts none unless it reads one itself.
|
|
176
|
+
- Each request in the batch must be the scope's strategy on its target,
|
|
177
|
+
with no callbacks, or the whole batch is refused with a 403.
|
|
178
|
+
- The requests run as the principal, with that principal's access when
|
|
179
|
+
they run: a principal who loses access to the target can no longer use
|
|
180
|
+
a token issued before. The principal has no live issuer token then, as
|
|
181
|
+
for a scheduled request, so the strategy cannot make delegated calls.
|
|
182
|
+
- Within its lifetime a token runs any number of requests; the strategy's
|
|
183
|
+
own limits (such as a maximum number of photos) bound what it can do.
|
|
184
|
+
|
|
141
185
|
## What the kernel requires of an issuer
|
|
142
186
|
|
|
143
187
|
- OIDC discovery and an RS256 JWKS.
|
|
@@ -165,8 +209,10 @@ Clients start from this document, never from a configured issuer URL:
|
|
|
165
209
|
`graphcore createadmin`) and only seeding or first contact creates a
|
|
166
210
|
`ServiceAccount`. No strategy creates or changes either.
|
|
167
211
|
- A `ServiceAccount` is never onboarded.
|
|
168
|
-
- The kernel verifies and maps. It never issues
|
|
169
|
-
its own initiative, or writes to an issuer.
|
|
212
|
+
- The kernel verifies and maps issuer tokens. It never issues an OAuth
|
|
213
|
+
token, exchanges one on its own initiative, or writes to an issuer.
|
|
214
|
+
- A strategy token runs one strategy on one target, as its principal, at
|
|
215
|
+
`execute_strategy_req` only.
|
|
170
216
|
- Authentication decides who; authorization decides what. A valid token
|
|
171
217
|
grants nothing by itself.
|
|
172
218
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Strategy tokens: short-lived bearer tokens, signed by the deployment, that
|
|
2
|
+
run one strategy on one target as the principal who asked for one. A shell
|
|
3
|
+
runs the strategy with one, sending params too large for a conversation, such
|
|
4
|
+
as a file's bytes, while the principal's own token never leaves its client.
|
|
5
|
+
Reading one gives its principal and its `StrategyScope`; the kernel sees only
|
|
6
|
+
those. See README.md (Strategy tokens)."""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import time
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
from django.core import signing
|
|
13
|
+
|
|
14
|
+
from graphcore.types.identity import Principal
|
|
15
|
+
from graphcore.types.strategy import StrategyScope
|
|
16
|
+
|
|
17
|
+
PREFIX = 'gcst.'
|
|
18
|
+
LIFETIME_SECONDS = 15 * 60
|
|
19
|
+
_SALT = 'graphcore.auth.strategy-token'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def issue(principal: Principal, scope: StrategyScope) -> tuple[str, float]:
|
|
23
|
+
"""The token for `principal` within `scope`, and when it expires."""
|
|
24
|
+
signed = signing.dumps(
|
|
25
|
+
{'p': principal.principal_entity_id, 's': scope.strategy_name, 't': scope.target_entity_id}, salt=_SALT,
|
|
26
|
+
)
|
|
27
|
+
return PREFIX + signed, time.time() + LIFETIME_SECONDS
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def read(token: Optional[str]) -> Optional[tuple[Principal, StrategyScope]]:
|
|
31
|
+
"""The principal and scope of a valid, unexpired strategy token; None for anything else."""
|
|
32
|
+
if not token or not token.startswith(PREFIX):
|
|
33
|
+
return None
|
|
34
|
+
try:
|
|
35
|
+
data = signing.loads(token[len(PREFIX):], salt=_SALT, max_age=LIFETIME_SECONDS)
|
|
36
|
+
except signing.BadSignature:
|
|
37
|
+
return None
|
|
38
|
+
return Principal(principal_entity_id=data['p']), StrategyScope(data['s'], data['t'])
|
|
@@ -328,6 +328,24 @@ Its schema is the strategy's request schema from the registry, with
|
|
|
328
328
|
signature; a parameter that is not a scalar shows as `json`, and the full
|
|
329
329
|
schema is returned in the error when `call` rejects the parameters.
|
|
330
330
|
|
|
331
|
+
A strategy tool declared with **`from_shell=True`** is run from the
|
|
332
|
+
agent's shell, for params too large to pass through the conversation,
|
|
333
|
+
such as a file's bytes: the model would have to write them out as text.
|
|
334
|
+
It takes no parameters but `target`, and `call` runs nothing. It returns:
|
|
335
|
+
|
|
336
|
+
| Field | Holds |
|
|
337
|
+
|---|---|
|
|
338
|
+
| `token` | A strategy token for the strategy on the target, as the user (`auth/authn/README.md`, Strategy tokens) |
|
|
339
|
+
| `url` | `execute_strategy_req` at the origin the agent reached `/mcp` on (`GRAPHCORE_PUBLIC_URL` when set) |
|
|
340
|
+
| `expires_at` | When the token expires; calling the tool again issues another |
|
|
341
|
+
| `request` | The request to POST, with the strategy and target set and `param_config` empty |
|
|
342
|
+
| `schema` | The strategy's request schema, which `param_config` follows |
|
|
343
|
+
| `how` | Building the request in the shell and posting it with the token, with an example `curl` |
|
|
344
|
+
|
|
345
|
+
The agent's shell then builds each request, reading any file from disk,
|
|
346
|
+
and posts it, so the file goes from disk to the deployment without passing
|
|
347
|
+
through the conversation.
|
|
348
|
+
|
|
331
349
|
An **operation** is a function decorated with `@operation`, taking `ctx`
|
|
332
350
|
and its parameters and declaring its request schema. It performs reads and
|
|
333
351
|
strategy executions through `ctx`, each checked as the user; it has no
|
|
@@ -1151,18 +1151,21 @@ used up, so an invite never downgrades anyone. Every refusal is the same
|
|
|
1151
1151
|
the kernel frontend). The token travels in the fragment, so it never
|
|
1152
1152
|
reaches a server log or a `Referer` header.
|
|
1153
1153
|
|
|
1154
|
-
**Sign-in and registration.**
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1154
|
+
**Sign-in and registration.** An invite link has no sign-in screen of its
|
|
1155
|
+
own. The kernel frontend's `InviteRoute` is mounted at `INVITE_ROUTE`
|
|
1156
|
+
behind the application's sign-in screen, like any signed-in page
|
|
1157
|
+
(`GraphCoreApp` does this). Signed out, the person sees that screen, which
|
|
1158
|
+
`usePendingInvite()` lets say they were invited; its ordinary OIDC sign-in
|
|
1159
|
+
carries the full URL, fragment included, in its `returnTo` state, so the
|
|
1160
|
+
person comes back to the link signed in. `InviteRoute` then redeems and
|
|
1161
|
+
hands the result to the application's `onRedeemed(invite)`, by default
|
|
1162
|
+
opening the resource's entity page. "Create account" sends `prompt=create`
|
|
1163
|
+
(OIDC Initiating User Registration); a sign-in screen offers it only when
|
|
1164
|
+
the issuer's discovery document lists `create` in `prompt_values_supported`
|
|
1165
|
+
(`useOffersRegistration()`), and otherwise the person registers from the
|
|
1166
|
+
issuer's own login page. Redemption is the same step for a new and an
|
|
1167
|
+
existing account, and nothing about it depends on the identity provider
|
|
1168
|
+
beyond standard OIDC.
|
|
1166
1169
|
|
|
1167
1170
|
Invites always redeem into a grant to a principal. Access without an
|
|
1168
1171
|
account would need a capability subject on the adapter's read path; see
|
|
@@ -135,6 +135,19 @@ class CpuUpload(Upload):
|
|
|
135
135
|
workload = Workload.CPU
|
|
136
136
|
|
|
137
137
|
|
|
138
|
+
class Attach(_ProbeStrategy):
|
|
139
|
+
"""Takes a file's bytes, as a strategy token's shell sends them."""
|
|
140
|
+
transient_params = frozenset({'data'})
|
|
141
|
+
param_schema = {'type': 'object', 'properties': {
|
|
142
|
+
'data': {'type': 'string'}, 'name': {'type': 'string'}, 'note': {'type': 'string'}}, 'required': ['data']}
|
|
143
|
+
|
|
144
|
+
async def apply(self):
|
|
145
|
+
params = self.strategy_request.param_config
|
|
146
|
+
self.entity.set_attribute('attached', params.get('name'))
|
|
147
|
+
self.strategy_request.ret_val = {'bytes': len(params['data'])}
|
|
148
|
+
return self.strategy_request, self.entity
|
|
149
|
+
|
|
150
|
+
|
|
138
151
|
class NotExecutable(_ProbeStrategy):
|
|
139
152
|
def verify_executable(self):
|
|
140
153
|
raise ValueError('probe is not ready')
|
|
@@ -209,7 +222,7 @@ class Untargeted(Strategy):
|
|
|
209
222
|
|
|
210
223
|
PROBE_STRATEGIES = (
|
|
211
224
|
Increment, CpuIncrement, Fail, CpuFail, Refuse, CpuRefuse, NoChange, ReadOnly, ConflictOnce, AlwaysConflict,
|
|
212
|
-
Validated, NotExecutable, Record, Upload, CpuUpload, Nested, CpuNested, WriteOther, SeeContext,
|
|
225
|
+
Validated, NotExecutable, Record, Upload, CpuUpload, Attach, Nested, CpuNested, WriteOther, SeeContext,
|
|
213
226
|
)
|
|
214
227
|
|
|
215
228
|
TEST_REGISTRY.entities.register_entity(_Probe, app_label='graphcore')
|
graphcore/testing/case.py
CHANGED
|
@@ -13,17 +13,24 @@ from django.test import TransactionTestCase
|
|
|
13
13
|
from graphcore.agent_frontend import testing as agent_testing
|
|
14
14
|
from graphcore.agent_frontend.render import Frontend
|
|
15
15
|
from graphcore.agent_frontend.testing import Place
|
|
16
|
+
from graphcore.auth.authn import strategy_tokens
|
|
16
17
|
from graphcore.auth.authn.principals import create_principal
|
|
17
18
|
from graphcore.auth.authz.lookups import find_group_by_key
|
|
18
19
|
from graphcore.auth.authz.kernel_writes import add_member
|
|
19
20
|
from graphcore.auth.authz.defaults import ADMINS_GROUP_KEY
|
|
21
|
+
from graphcore.errors import NotFound
|
|
20
22
|
from graphcore.execution.strategy_context import kernel_internal_context
|
|
21
23
|
from graphcore.registry.app_discovery import discover_agent_frontends
|
|
22
24
|
from graphcore.runtime import configured_runtime
|
|
23
25
|
from graphcore.transport.agent_client import InProcessGraphClient
|
|
26
|
+
from graphcore.types.api import StrategyOutcome
|
|
24
27
|
from graphcore.types.identity import Principal
|
|
25
28
|
|
|
26
29
|
|
|
30
|
+
# Where a test's strategy tokens send files; the real one is the caller's own origin.
|
|
31
|
+
TEST_EXECUTE_URL = 'http://testserver/graphcore/api/execute_strategy_req/'
|
|
32
|
+
|
|
33
|
+
|
|
27
34
|
@task_postrun.connect(weak=False, dispatch_uid='graphcore.testing.close_task_connections')
|
|
28
35
|
def _close_task_connections(**kwargs):
|
|
29
36
|
# A worker's Django fixup does this; an eager task's pool thread would
|
|
@@ -75,6 +82,18 @@ class GraphCoreTestCase(TransactionTestCase):
|
|
|
75
82
|
completed, _ = await self.runtime.executor.submit(request, principal)
|
|
76
83
|
return completed
|
|
77
84
|
|
|
85
|
+
async def run_with_strategy_token(self, token: str, request) -> StrategyOutcome:
|
|
86
|
+
"""Run the `StrategyRequestPayload` with a strategy token, as a shell
|
|
87
|
+
does at `execute_strategy_req`, and return its outcome. Raises
|
|
88
|
+
`NotFound` for an invalid or expired token and `Forbidden` for a
|
|
89
|
+
request the token does not cover."""
|
|
90
|
+
scoped = strategy_tokens.read(token)
|
|
91
|
+
if scoped is None:
|
|
92
|
+
raise NotFound('No such strategy token')
|
|
93
|
+
principal, scope = scoped
|
|
94
|
+
(outcome,) = await self.api.execute_strategies(principal, [request], wait=True, scope=scope)
|
|
95
|
+
return outcome
|
|
96
|
+
|
|
78
97
|
async def get_entity(self, principal: Principal, entity_id: str):
|
|
79
98
|
"""`entity_id` as `principal` sees it: the entity, or a tombstone
|
|
80
99
|
when they can't read it."""
|
|
@@ -110,5 +129,8 @@ class GraphCoreTestCase(TransactionTestCase):
|
|
|
110
129
|
`result`, `address`, `version` and `note`, and `images`, the `Image`s an
|
|
111
130
|
operation returned (placeholders stand in for them in `result`). Raises `AgentError` as `/mcp`
|
|
112
131
|
reports it: `Refused` for a refused run, `NotFound`, `Stale` when
|
|
113
|
-
`seen_version` is outdated, `UnknownTool`, `InvalidRequest` for bad params.
|
|
114
|
-
|
|
132
|
+
`seen_version` is outdated, `UnknownTool`, `InvalidRequest` for bad params.
|
|
133
|
+
A `from_shell` tool returns a strategy token for `TEST_EXECUTE_URL`."""
|
|
134
|
+
return await agent_testing.call_tool(
|
|
135
|
+
self._agent_frontend(), principal, at, tool, params, seen_version, TEST_EXECUTE_URL,
|
|
136
|
+
)
|
|
@@ -7,6 +7,7 @@ from pathlib import Path
|
|
|
7
7
|
from typing import Callable, Optional, Sequence
|
|
8
8
|
|
|
9
9
|
from django.conf import settings
|
|
10
|
+
from django.urls import NoReverseMatch, reverse
|
|
10
11
|
|
|
11
12
|
from graphcore.agent_frontend.loading import load_registry
|
|
12
13
|
from graphcore.agent_frontend.server import create_app
|
|
@@ -30,6 +31,14 @@ def _base(scope) -> str:
|
|
|
30
31
|
return resource_metadata.public_base(scope.get('scheme', 'http'), host)
|
|
31
32
|
|
|
32
33
|
|
|
34
|
+
def _execute_url(scope) -> str:
|
|
35
|
+
"""Empty when the deployment does not mount the kernel's HTTP API."""
|
|
36
|
+
try:
|
|
37
|
+
return _base(scope) + reverse('api_execute_strategy_req')
|
|
38
|
+
except NoReverseMatch:
|
|
39
|
+
return ''
|
|
40
|
+
|
|
41
|
+
|
|
33
42
|
async def _serve_metadata(scope, send, resource_path: str) -> None:
|
|
34
43
|
headers = [(b'access-control-allow-origin', b'*')]
|
|
35
44
|
if scope['method'] == 'OPTIONS':
|
|
@@ -55,7 +64,7 @@ def with_agent_frontend(
|
|
|
55
64
|
InProcessGraphClient(), load_registry(discover_agent_frontends(apps_dir)), MCP_PATH,
|
|
56
65
|
allowed_origins=allowed_origins,
|
|
57
66
|
challenge=lambda scope: resource_metadata.challenge(_base(scope), MCP_PATH),
|
|
58
|
-
web_url=web_url,
|
|
67
|
+
web_url=web_url, execute_url=_execute_url,
|
|
59
68
|
)
|
|
60
69
|
|
|
61
70
|
async def application(scope, receive, send):
|
|
@@ -3,12 +3,13 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
from typing import Any, Optional
|
|
5
5
|
|
|
6
|
-
from graphcore.auth.authn import authenticate
|
|
6
|
+
from graphcore.auth.authn import authenticate, strategy_tokens
|
|
7
|
+
from graphcore.errors import InvalidRequest, NotFound
|
|
7
8
|
from graphcore.runtime import get_runtime
|
|
8
|
-
from graphcore.types.entities import EntityFilter, EntityPage
|
|
9
|
+
from graphcore.types.entities import EntityFilter, EntityPage, Tombstone
|
|
9
10
|
from graphcore.types.identity import Principal
|
|
10
11
|
from graphcore.types.query import AllOf, Equal, InValues, Predicate
|
|
11
|
-
from graphcore.types.strategy import StrategyRequestPayload
|
|
12
|
+
from graphcore.types.strategy import StrategyRequestPayload, StrategyScope
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
def _predicate(where: Predicate | dict | None) -> Optional[Predicate]:
|
|
@@ -65,6 +66,17 @@ class InProcessGraphClient:
|
|
|
65
66
|
(outcome,) = await self._api.execute_strategies(principal, [payload], wait=True)
|
|
66
67
|
return outcome.to_dict()
|
|
67
68
|
|
|
69
|
+
async def issue_strategy_token(
|
|
70
|
+
self, principal: Principal, strategy_name: str, target_id: str,
|
|
71
|
+
) -> tuple[str, float]:
|
|
72
|
+
"""Refused unless `principal` can read the target and the strategy runs on it."""
|
|
73
|
+
target = await self._api.get_entity(principal, target_id)
|
|
74
|
+
if isinstance(target, Tombstone):
|
|
75
|
+
raise NotFound(f"{target_id} does not exist or is not readable")
|
|
76
|
+
if strategy_name not in {s['name'] for s in self._api.type_strategies(target.entity_type_id)}:
|
|
77
|
+
raise InvalidRequest(f"{strategy_name} does not run on {target.entity_type_id}")
|
|
78
|
+
return strategy_tokens.issue(principal, StrategyScope(strategy_name, target.entity_id))
|
|
79
|
+
|
|
68
80
|
def resolve(self, address: str) -> dict:
|
|
69
81
|
return self._api.resolve(address)
|
|
70
82
|
|
graphcore/transport/views.py
CHANGED
|
@@ -9,7 +9,7 @@ from graphcore.runtime import get_runtime
|
|
|
9
9
|
from graphcore.types.identity import Principal
|
|
10
10
|
from graphcore.types.api import StrategyRequestPayload
|
|
11
11
|
from graphcore.types.entities import EntityFilter, Tombstone, client_view
|
|
12
|
-
from graphcore.auth.authn import authenticate, resource_metadata
|
|
12
|
+
from graphcore.auth.authn import authenticate, resource_metadata, strategy_tokens
|
|
13
13
|
from graphcore.api.predicate_codec import decode_predicate
|
|
14
14
|
from graphcore.errors import (
|
|
15
15
|
Forbidden, InvalidQuery, InvalidRequest, NotFound, UnsupportedQuery, log_and_correlate,
|
|
@@ -283,7 +283,9 @@ async def api_execute_strategy_req(request):
|
|
|
283
283
|
if request.method != 'POST':
|
|
284
284
|
return JsonResponse({'error': 'POST method required'}, status=400)
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
# The one endpoint a strategy token is good for.
|
|
287
|
+
scoped = strategy_tokens.read(request.headers.get('Authorization', '').removeprefix('Bearer '))
|
|
288
|
+
principal, scope = scoped or (await _principal(request), None)
|
|
287
289
|
if not principal:
|
|
288
290
|
return _unauthorized(request)
|
|
289
291
|
|
|
@@ -298,7 +300,7 @@ async def api_execute_strategy_req(request):
|
|
|
298
300
|
await_response = data.get('await_response', False)
|
|
299
301
|
|
|
300
302
|
outcomes = await get_runtime().graph_api.execute_strategies(
|
|
301
|
-
principal, payloads, wait=bool(await_response)
|
|
303
|
+
principal, payloads, wait=bool(await_response), scope=scope,
|
|
302
304
|
)
|
|
303
305
|
return JsonResponse({
|
|
304
306
|
'await_response': bool(await_response),
|
|
@@ -306,6 +308,8 @@ async def api_execute_strategy_req(request):
|
|
|
306
308
|
})
|
|
307
309
|
except InvalidRequest as exc:
|
|
308
310
|
return JsonResponse({'error': str(exc)}, status=400)
|
|
311
|
+
except Forbidden as exc:
|
|
312
|
+
return JsonResponse({'error': str(exc)}, status=403)
|
|
309
313
|
except json.JSONDecodeError:
|
|
310
314
|
return JsonResponse({'error': 'Invalid JSON'}, status=400)
|
|
311
315
|
except Exception:
|
graphcore/types/strategy.py
CHANGED
|
@@ -71,3 +71,14 @@ class StrategyRequestPayload:
|
|
|
71
71
|
if self.client_request_id is not None:
|
|
72
72
|
out['client_request_id'] = self.client_request_id
|
|
73
73
|
return out
|
|
74
|
+
|
|
75
|
+
def within(self, scope: StrategyScope) -> bool:
|
|
76
|
+
return (self.strategy_name, self.target_entity_id) == (scope.strategy_name, scope.target_entity_id) \
|
|
77
|
+
and not self.callbacks
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass(frozen=True)
|
|
81
|
+
class StrategyScope:
|
|
82
|
+
"""What a caller may run: one strategy on one target, with no callbacks."""
|
|
83
|
+
strategy_name: str
|
|
84
|
+
target_entity_id: str
|
|
@@ -8,26 +8,26 @@ graphcore/tasks.py,sha256=Yi5-k7p44hK8d-iNHGhCyvZHV7VeopnewkhHqQo5is4,527
|
|
|
8
8
|
graphcore/test_settings.py,sha256=ekz-D_Y62Y1GOupw4iaT8iFWd0h1dhK2qlWFDdbvErY,2661
|
|
9
9
|
graphcore/urls.py,sha256=_9gGtKDD2NUze0i3a1ld93DBAJ35YjKLGeSJ5hpXdSY,196
|
|
10
10
|
graphcore/agent_frontend/__init__.py,sha256=99rtPZNIEW2Y05nIhv-rqQADDzHKp1IjCOek9kDyU9k,374
|
|
11
|
-
graphcore/agent_frontend/api.py,sha256=
|
|
12
|
-
graphcore/agent_frontend/client.py,sha256=
|
|
11
|
+
graphcore/agent_frontend/api.py,sha256=frL-L4YlgBrz8HTJpj7YySGUxlL8eAuG7PAju1XcFHY,2990
|
|
12
|
+
graphcore/agent_frontend/client.py,sha256=qYGVls-_L9H6abRSbztIH-KcXzqJgUOFtbMir28BgsM,1556
|
|
13
13
|
graphcore/agent_frontend/context.py,sha256=tb4yJkKvcxMzuAAigA24HtnDwBCwWLaRk-Nyp5vA-dU,6181
|
|
14
14
|
graphcore/agent_frontend/errors.py,sha256=NPZkHoU8LzueeWi2YPHBazYaP3dYPSk1k8HyCm6deKA,428
|
|
15
15
|
graphcore/agent_frontend/loading.py,sha256=8c_Rsy5AciZVqoR33pxP0ti-f_znqjXnTOdDRC_dljQ,2133
|
|
16
16
|
graphcore/agent_frontend/registry.py,sha256=iZfl8so5FnS9aQb7OsrUY8rYl4FTR6tWYT6wS9HxQl4,1525
|
|
17
|
-
graphcore/agent_frontend/render.py,sha256=
|
|
18
|
-
graphcore/agent_frontend/server.py,sha256=
|
|
17
|
+
graphcore/agent_frontend/render.py,sha256=fwbK4nbrtBIINaRdTQo9ig-Dm1-zPleM3_CUQLiIlNY,8319
|
|
18
|
+
graphcore/agent_frontend/server.py,sha256=yi0KNUneugJB7UvrQYfSqC1f1MJ0d-P9CO5hpJUdl0g,6140
|
|
19
19
|
graphcore/agent_frontend/signatures.py,sha256=ioBF82vYDx3Z68zhhC7wvle8NPBLXc8Uzw-pdneeUTw,1395
|
|
20
|
-
graphcore/agent_frontend/testing.py,sha256=
|
|
21
|
-
graphcore/agent_frontend/tools.py,sha256=
|
|
20
|
+
graphcore/agent_frontend/testing.py,sha256=iPzVWaSXxgf_NGU4OM0PJWznWIMMi8ZcxG2DLIhaxvE,1690
|
|
21
|
+
graphcore/agent_frontend/tools.py,sha256=f6dhHAcGCyf1LUQru4igyL95ynMs2JLAhDAfMs8O5HY,8814
|
|
22
22
|
graphcore/agent_frontend/base/__init__.py,sha256=rXxDIEx_UeBDOl82zY0pfHyDupyQJPzio4uQCRzhY9s,582
|
|
23
23
|
graphcore/agent_frontend/base/views.py,sha256=2QD04H9H-vcAE1enrxZcxnuey2P3SdpEXTLhpn8Aug0,7005
|
|
24
24
|
graphcore/agent_frontend/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
graphcore/agent_frontend/tests/fakes.py,sha256=
|
|
26
|
-
graphcore/agent_frontend/tests/test_frontend.py,sha256=
|
|
25
|
+
graphcore/agent_frontend/tests/fakes.py,sha256=XoHGkjmIYnnK6PDpldAxXN3xc1DJx6zhPAa6Nz2Kj74,5301
|
|
26
|
+
graphcore/agent_frontend/tests/test_frontend.py,sha256=_hcBdHnZZJBS_LNU7bYgg9_AYDqZOmIk2g5065fLRBU,25143
|
|
27
27
|
graphcore/agent_frontend/tests/test_loading.py,sha256=2OJ_mWSdW_6mdIp9Xc1ZgJAewDy7y9qzM-K9tp_J0FQ,3861
|
|
28
28
|
graphcore/agent_frontend/tests/test_server.py,sha256=ybdFJXyHTPB3A380wG4hKCB3As7xnKE1A4LRBRkP-7M,7960
|
|
29
29
|
graphcore/api/__init__.py,sha256=vmtH9z-X0yeBc07a_X3i81P6ZIv-JvwLHbY0BScWrdM,101
|
|
30
|
-
graphcore/api/graph_api.py,sha256=
|
|
30
|
+
graphcore/api/graph_api.py,sha256=_DVW_HQMaSazWgND5lI3S1F80P3QLCX9ZvxFiOjl22k,18185
|
|
31
31
|
graphcore/api/predicate_codec.py,sha256=-mbL0OFxkA9VOch0g4M018WI0Lz7XYq7KK1avwrmBxA,3282
|
|
32
32
|
graphcore/api/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
graphcore/api/tests/test_changed_entities.py,sha256=jou8Wd8HQb0LJhNLsY2S506bChSDRdiSX_GGRal1Opg,4695
|
|
@@ -35,15 +35,17 @@ graphcore/api/tests/test_graph_api.py,sha256=cSzvCSk6EONC2K5JDwLePPZD0fN3oq8ZEWA
|
|
|
35
35
|
graphcore/api/tests/test_graph_api_access.py,sha256=LVm2Bjy7LpRS1oTFhZpZiDeh5j_PMnQKvysRvLXN7CM,4202
|
|
36
36
|
graphcore/api/tests/test_graph_api_grants.py,sha256=DT4eplPkbisDvle4ZGW5MLlg0tq8GSqlam8B86JUYa8,4019
|
|
37
37
|
graphcore/api/tests/test_predicate_codec.py,sha256=0EFakHVkBfcynrTuRzEjQ722H0IHqIPBf7WnQl6bUDs,3324
|
|
38
|
+
graphcore/api/tests/test_strategy_tokens.py,sha256=ZkZDjUkUS0X6QETkxobCR_29EG7JrvChSBdjRDmQRwI,7180
|
|
38
39
|
graphcore/api/tests/test_subtree_query.py,sha256=f2fH4tXuuRDJpTXSkFLA62k5LWJR0LcdL82gBNDHlNA,3172
|
|
39
40
|
graphcore/auth/__init__.py,sha256=FC0n8yHDNVUw-PmOgq-e_YIhpDpobF1LOyW1NFDIfT0,56
|
|
40
|
-
graphcore/auth/authn/README.md,sha256=
|
|
41
|
+
graphcore/auth/authn/README.md,sha256=eULtJZL35Ibk_Bi3Zw9fSAIj2T0GcdiyVbs-2ISbqr0,11999
|
|
41
42
|
graphcore/auth/authn/__init__.py,sha256=nKF01Qjq-qpO8GW1hMAEnv6-5QobRPY0M1FxT7-RE-Q,88
|
|
42
43
|
graphcore/auth/authn/authenticator.py,sha256=rFcZElA4qiVKue8jLd4gT5aF9WYm5jlAmyKq1DC9fGg,4352
|
|
43
44
|
graphcore/auth/authn/onboarding.py,sha256=lXMnDHm6nv1jHESmEr03PoCQO3DdaYHRnlmVXPgQVIQ,4811
|
|
44
45
|
graphcore/auth/authn/principals.py,sha256=lnNVuDonTladCMlD_0JcYQnV-ecaqdXKiRBBRfzkLUU,966
|
|
45
46
|
graphcore/auth/authn/resource_metadata.py,sha256=ANa6sRssyeW0aJ0cv9Sf2aurOo65ZqzzvJR9GU9GLvE,1696
|
|
46
47
|
graphcore/auth/authn/service_accounts.py,sha256=CzsAKQ9C4on6CCZCfE7a2X_1e0qIUW_ILfZ8zSFwRmU,4077
|
|
48
|
+
graphcore/auth/authn/strategy_tokens.py,sha256=kZXWFgslkIrpTXj4NEMbuJ97YBYzntZjVlSQIb-ba10,1562
|
|
47
49
|
graphcore/auth/authn/testing.py,sha256=R-1-rBmZ3YpC7SJmwTSoQh7Nk_8Ieehn1VKeBM7-Fto,3439
|
|
48
50
|
graphcore/auth/authn/users.py,sha256=2x4qbIBVCLqz_XP-oN22V3apu2TmhD6I_a-5DM-0JnI,2609
|
|
49
51
|
graphcore/auth/authn/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -87,9 +89,9 @@ graphcore/broadcast/broadcaster.py,sha256=E8TBqYBMPA8gA0ru1QN29RTL8_4oxTasPgGUTA
|
|
|
87
89
|
graphcore/broadcast/channels.py,sha256=pJzGpWwYrCzLNusipd-va4zr7DzyTBsB8eH0Ze6O2sI,2336
|
|
88
90
|
graphcore/broadcast/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
91
|
graphcore/broadcast/tests/test_broadcaster.py,sha256=KrgsGMifuobqae6wgiLeqDAI_wHAwMubaV6T9a8n2i8,20719
|
|
90
|
-
graphcore/docs/AGENT_FRONTEND_TDD.md,sha256=
|
|
92
|
+
graphcore/docs/AGENT_FRONTEND_TDD.md,sha256=LNsoIs5GhPcl3MxQaP04nqxA4VeJKfOYtor-t0s3tag,21328
|
|
91
93
|
graphcore/docs/ARCHITECTURE_PRINCIPLES.md,sha256=Y3Y1h9zQ8oZtPxYNrthlivIu77yESl4Q2kMXimSCGzU,8620
|
|
92
|
-
graphcore/docs/AUTHORIZATION_TECHNICAL_TDD.md,sha256=
|
|
94
|
+
graphcore/docs/AUTHORIZATION_TECHNICAL_TDD.md,sha256=_z0Xv4Gq9pKfA81G6OYsfydu_oggTSoQ6TYSK2oichQ,85215
|
|
93
95
|
graphcore/docs/ENTITY_REFERENCE_TDD.md,sha256=aE8dm_YNV1mIPboi5YJvrzOiNQxy6qaprLL_31u-f2c,28657
|
|
94
96
|
graphcore/docs/GRAPHAPI_FRONT_DOOR.md,sha256=QuIxgUvC0rrtvcH0UGiRP3KIkGnpTEhy-DfAAiYRP44,9204
|
|
95
97
|
graphcore/docs/RUNTIME.md,sha256=oVZ9ElyEH6TO9OJyn7gYy_CKEywspgMHVMUjDB6-UhA,4849
|
|
@@ -171,7 +173,7 @@ graphcore/execution/environments/celery.py,sha256=sPnuVq6FdM1BJ_V5IcbFPf9-PDZ30y
|
|
|
171
173
|
graphcore/execution/environments/in_process.py,sha256=G0f1BouZj_GmExLZNy_Dv2rjpCSxKUvm-7G0iB3vPa0,2382
|
|
172
174
|
graphcore/execution/tests/__init__.py,sha256=LUY88a3m44dPdYIB06jHa7ZzmY6KoGteWucSHlohWso,30
|
|
173
175
|
graphcore/execution/tests/contract.py,sha256=338XjICbGchx2VN10_Vua8eAlumelkrrGtFk4bT_8A0,8172
|
|
174
|
-
graphcore/execution/tests/support.py,sha256=
|
|
176
|
+
graphcore/execution/tests/support.py,sha256=US2WIJoZdGyVy5K5ZM0cif142XtzNLJ34ymC3fh7gQ8,11785
|
|
175
177
|
graphcore/execution/tests/test_dispatchers.py,sha256=Cd1uVn4HXCJ5-e-JZVGz8Edlm3JjfZuIeuSsTA5rb7s,3211
|
|
176
178
|
graphcore/execution/tests/test_executor.py,sha256=jJmSIKDcsMXEcDVvAwTWezGYixXdaCl8N-f4YVdDa2I,18870
|
|
177
179
|
graphcore/execution/tests/test_local_session.py,sha256=ZSDfjKDH4fPm9565E0ysAyasXFKQVElRzVZu1-O8VjQ,4020
|
|
@@ -284,7 +286,7 @@ graphcore/scheduling/tests/test_beat_scheduler.py,sha256=1np9vFWhxF8VlPeOGYzDtQl
|
|
|
284
286
|
graphcore/scheduling/tests/test_memory_scheduler.py,sha256=i1E_YwSpiV9w2-IGSIUPgpbWa6YyOruJYzVoPf21_gs,465
|
|
285
287
|
graphcore/scheduling/tests/test_ticks.py,sha256=6zUC5yF0NxcGfv7gRLb5R3dc74n1sgKhhyJb_RZcHKA,8316
|
|
286
288
|
graphcore/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
287
|
-
graphcore/testing/case.py,sha256=
|
|
289
|
+
graphcore/testing/case.py,sha256=_eErdpTwhe34NhhH3JRX5edxdhQUcUGmFyVilE7SnGA,6770
|
|
288
290
|
graphcore/testing/runner.py,sha256=FsVAgSiPFhVz12dPGX5r4HA3aee3_xpeWq3bDWcLFQw,1233
|
|
289
291
|
graphcore/testing/settings.py,sha256=qBN6EVyOiq73NUID9YKyOa23CbUDn3FtqHDgQQ8rX9g,1130
|
|
290
292
|
graphcore/testing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -308,13 +310,13 @@ graphcore/tests/test_shared_type_boundaries.py,sha256=kP5IroNGTB2B0wIsPwB6-dewMi
|
|
|
308
310
|
graphcore/tests/test_shared_types.py,sha256=I0Fi32AJdBgObv8N9Us6JX1EF_hvfhEBLsFv5NKJTdY,7363
|
|
309
311
|
graphcore/tests/test_test_settings.py,sha256=f1feMYhNx0zJXh3IJL-OsPg8ycvpJLn9encW58CwGBs,1707
|
|
310
312
|
graphcore/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
311
|
-
graphcore/transport/agent_asgi.py,sha256=
|
|
312
|
-
graphcore/transport/agent_client.py,sha256=
|
|
313
|
+
graphcore/transport/agent_asgi.py,sha256=4WjFlkQfNTZrPCpBioEUabajeUV0lrdFEPHlgFViGtU,3380
|
|
314
|
+
graphcore/transport/agent_client.py,sha256=N95yQrYfIRR_uZhycGwRvdw6g8frSGRVN5qF9KKMrXg,4080
|
|
313
315
|
graphcore/transport/channel_layer.py,sha256=swLpod2gna5DMh6JZw3jWfNPJIaRVRKatdk7TnAyjgk,2871
|
|
314
316
|
graphcore/transport/consumers.py,sha256=jLArPMKIUly148q5jY5hQSs4lpr1iB7D4R_l7nn0i9c,22321
|
|
315
317
|
graphcore/transport/routing.py,sha256=mdC7l-5AVdKPV3t4j2O6y2XmgEK6YE9QPsMbK-D5kI4,176
|
|
316
318
|
graphcore/transport/urls.py,sha256=Is7EcmiRn3JNLp_zqDsyM1yXHS0IHtVSPK7shjSq0cs,1483
|
|
317
|
-
graphcore/transport/views.py,sha256=
|
|
319
|
+
graphcore/transport/views.py,sha256=M7uK_H1ny6MY3vUJdqDoEdQ3cottApxWMzEpxx89vqs,14532
|
|
318
320
|
graphcore/transport/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
319
321
|
graphcore/transport/tests/test_agent_client.py,sha256=E4NG5B4X5nsLd75YiyJY7AE0ZQkY0I2UbEsyf0uZEew,1294
|
|
320
322
|
graphcore/transport/tests/test_api_views.py,sha256=nngNEOTq4v3rRZcugAsj5AcxkITgnndftb5IRYzYWQM,34569
|
|
@@ -331,13 +333,13 @@ graphcore/types/identity.py,sha256=6JsmbY7TBtnQYhP5iliQiVMxeYpLdOuxfPNjmV0M3pw,6
|
|
|
331
333
|
graphcore/types/onboarding.py,sha256=jw-nNpMWUf0fsSISKV_2Bai4-gumJadyxGQDfuqXUQg,796
|
|
332
334
|
graphcore/types/query.py,sha256=fFB1bUpQ-OSLgP10O6Q3WWvfoNq131UZVw0-J-lzvgs,3456
|
|
333
335
|
graphcore/types/schedules.py,sha256=4hMr6o0kJ6utbf-XSWFw_3_qkhpL3s32q6dsRdHmSIU,2919
|
|
334
|
-
graphcore/types/strategy.py,sha256=
|
|
336
|
+
graphcore/types/strategy.py,sha256=De3z3aFC63s96SzDzNeCFXSS2L8yrmJV0ck2eEA6adw,2998
|
|
335
337
|
graphcore/types/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
336
338
|
graphcore/types/tests/test_entity_id.py,sha256=dvF0wLsN9aGRI0J11i__fSFC8bKQTO5Wj1oFu9-2T8Q,1885
|
|
337
|
-
graphcore_kernel-0.2.
|
|
338
|
-
graphcore_kernel-0.2.
|
|
339
|
-
graphcore_kernel-0.2.
|
|
340
|
-
graphcore_kernel-0.2.
|
|
341
|
-
graphcore_kernel-0.2.
|
|
342
|
-
graphcore_kernel-0.2.
|
|
343
|
-
graphcore_kernel-0.2.
|
|
339
|
+
graphcore_kernel-0.2.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
340
|
+
graphcore_kernel-0.2.1.dist-info/licenses/NOTICE,sha256=O2mV23MKwYlPOz9-8wsTSRNH3noH5-ie_sFFAvoOc_A,40
|
|
341
|
+
graphcore_kernel-0.2.1.dist-info/METADATA,sha256=MKPRwqn1rqozeMZBWCJ1RbqGNVpLQ-wTKWAxCoJDbaE,3197
|
|
342
|
+
graphcore_kernel-0.2.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
343
|
+
graphcore_kernel-0.2.1.dist-info/entry_points.txt,sha256=PjyzUjOAsQAhWFDJvPh37PMh8lqypo_KUUDSK214j6Y,52
|
|
344
|
+
graphcore_kernel-0.2.1.dist-info/top_level.txt,sha256=3GxRSE2Ws8H2BMLBStYy5hD2rMhuvDfOtoJ3EP-Pm3A,10
|
|
345
|
+
graphcore_kernel-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|