diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2f8d1100..2f27b224 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,6 +51,11 @@ jobs: - run: build/workspace-training/bin/python -m unittest discover -s tests -p test_volume_assets.py - run: build/workspace-training/bin/python -m unittest discover -s tests -p test_rheon_cpu_training.py - run: build/workspace-training/bin/python -m unittest discover -s tests -p test_rheon_evaluation.py + - run: python -m venv build/workspace-agent + - run: build/workspace-agent/bin/python -m pip install -r requirements.txt + - run: build/workspace-agent/bin/python -m pip install --require-hashes -r requirements-agent.lock + - run: build/workspace-agent/bin/python -m unittest discover -s tests -p 'test_agent_*.py' + - run: build/workspace-agent/bin/python -m unittest discover -s tests -p test_mcp_stdio.py - run: python -m unittest discover -s tests - run: node --check static/auth.js - run: node tests/test_auth_helpers.cjs diff --git a/.gitignore b/.gitignore index 56107359..91a117a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .venv/ .venv-training/ +.venv-agent/ __pycache__/ *.pyc data/ diff --git a/README.md b/README.md index 862dd154..68116b55 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,45 @@ complete backup/restore, supported versions and preservation limits. Open http://127.0.0.1:8091. Change the port or data location with --port and --data. Camera access works on localhost; accessing a machine over the network requires HTTPS for browser camera access. Image import also works without camera access. +## Local agent connection + +The optional MCP stdio bridge connects to an already running Tuldok server on a +numeric loopback address. Install its separate dependencies explicitly: + +```sh +python3.12 -m venv .venv-agent +.venv-agent/bin/python -m pip install --require-hashes -r requirements-agent.lock +.venv-agent/bin/python mcp_stdio.py --config /private/tuldok-agent.json +``` + +The supplied dependency lock targets CPython 3.12 on Linux x86-64; it does not +claim other interpreter/platform combinations. The app and training environments +remain separate. + +Use a private configuration file with `endpoint`, `catalog_id` and `token_file`: + +```json +{ + "endpoint": "http://127.0.0.1:8091", + "catalog_id": "YOUR_CATALOG_ID", + "token_file": "/private/tuldok-agent-token" +} +``` + +The token file must contain an owner-issued **agent** credential and be readable +only by its owner. Keep tokens out of command arguments and MCP configuration +shared with others. Obtain catalog identity from the authenticated workspace +context. The bridge checks that identity, credential kind and operation-registry +digest before use; it never creates a server, catalog or credential. + +See [agent operations](docs/contracts/agent-operations.md) for credential setup, +the supported tool matrix, request limits and examples. Human review and exact +execution grants remain owner actions. Tools can save drafts, freeze approved +data, edit graphs and submit explicitly approved external Runs. Artifact segments +require the client to verify the reassembled whole-file hash before use; ordinary +verified HTTP downloads remain available. Ending the MCP connection does not +cancel an admitted Run. Use its scoped cancellation operation when required. + ## Real image workflow in Workspaces [Real workflow screenshots](docs/images/workspaces-m2/README.md) show Data, diff --git a/agent_api.py b/agent_api.py new file mode 100644 index 00000000..3cdda071 --- /dev/null +++ b/agent_api.py @@ -0,0 +1,635 @@ +"""Versioned agent operations and bounded client of the existing local HTTP owner. + +Import/discovery use only the standard library. Optional jsonschema is loaded by +argument validation, never by the application discovery route. +""" +import base64 +import binascii +import copy +import hashlib +import http.client +import json +import math +import os +from pathlib import Path +import re +import socket +import stat +import time +import threading +from urllib.parse import quote, urlencode, urlsplit + +REGISTRY_VERSION = 1 +REQUEST_LIMIT = 1024 * 1024 +RESPONSE_LIMIT = 16 * 1024 * 1024 +MCP_RESPONSE_LIMIT = 32 * 1024 * 1024 +INLINE_LIMIT = 512 * 1024 +DEPTH_LIMIT = 64 +ID = {'type': 'string', 'pattern': '^[a-f0-9]{32}$'} +SHA = {'type': 'string', 'pattern': '^[a-f0-9]{64}$'} +REF = {'type': 'string', 'pattern': '^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$'} +NAME = {'type': 'string', 'pattern': '^[A-Za-z][A-Za-z0-9_-]{0,39}$'} +SLOT = '^[A-Za-z][A-Za-z0-9_-]{0,63}$' +ARTIFACT = {'type': 'string', 'pattern': '^[A-Za-z0-9][A-Za-z0-9_.-]{0,119}$', + 'not': {'enum': ['artifact-manifest.json', 'custody-receipt.json']}} + + +class AgentAPIError(Exception): + """Safe transport error: never contains a credential or remote traceback.""" + def __init__(self, message, code='invalid', status=400): + super().__init__(message) + self.code, self.status = code, status + + +def encoded(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('utf-8') + + +def obj(properties=None, required=None): + properties = properties or {} + return {'type': 'object', 'properties': properties, + 'required': list(properties) if required is None else required, + 'additionalProperties': False} + + +def text(maximum, empty=False): + result = {'type': 'string', 'maxLength': maximum} + if not empty: + result.update(minLength=1, pattern=r'\S') + return result + + +def integer(minimum=0, maximum=None): + result = {'type': 'integer', 'minimum': minimum} + if maximum is not None: + result['maximum'] = maximum + return result + + +def array(items, maximum, minimum=0): + return {'type': 'array', 'items': items, 'minItems': minimum, 'maxItems': maximum} + + +def const(value): + return {'const': value} + + +GROUPS = array(text(120), 30, 1) +OPTIONAL_META = {'name': text(200), 'rights': text(1000), 'groups': GROUPS, + 'parents': array(text(120), 30)} +B64 = {'type': 'string', 'maxLength': 4 * ((INLINE_LIMIT + 2) // 3), + 'pattern': '^[A-Za-z0-9+/]*={0,2}$'} +PARAMETERS = {'type': 'object', 'maxProperties': 32, 'propertyNames': {'pattern': SLOT}, + 'additionalProperties': {'oneOf': [{'type': 'boolean'}, {'type': 'number'}, + {'type': 'string', 'maxLength': 1024}]}} +BINDING = {'oneOf': [obj({'reference_id': REF, 'expected_sha256': SHA}), + obj({'kind': const('frozen_release'), 'release_id': SHA, 'expected_sha256': SHA}), + obj({'kind': const('run_artifact'), 'run_id': ID, 'artifact_name': ARTIFACT, + 'expected_sha256': SHA})]} +BINDINGS = {'type': 'object', 'maxProperties': 32, 'propertyNames': {'pattern': SLOT}, + 'additionalProperties': BINDING} +EXTERNAL_INPUT = obj({'project_id': ID, 'recipe_id': REF, 'expected_sha256': SHA, 'inputs': BINDINGS}) +RECIPES = ['image_classification', 'text_classification', 'audio_classification', + 'mesh_validate_export', 'sequence_validate_export', 'pointcloud_validate_export', + 'volume_validate_export', 'image_validate_export', 'text_validate_export', 'audio_validate_export'] +TRAINING = { + 'image_classification': obj({'epochs': integer(1, 5), 'batch_size': integer(1, 16), + 'learning_rate': {'type': 'number', 'minimum': .00001, 'maximum': .01}, 'seed': integer(0, 2**32-1)}), + 'text_classification': obj({'max_features': integer(64, 4096), 'alpha': {'type': 'number', 'minimum': .01, 'maximum': 10}}), + 'audio_classification': obj({'C': {'type': 'number', 'minimum': .01, 'maximum': 100}}), +} + + +def graph_schema(): + variants = [] + for recipe in RECIPES + ['external_recipe']: + stages = {'input': EXTERNAL_INPUT, 'execute': PARAMETERS, 'output': obj()} if recipe == 'external_recipe' else { + 'release': obj({'release_id': SHA}), 'validate': obj(), 'publish': obj()} + if recipe in TRAINING: + stages.update(train=TRAINING[recipe], evaluate=obj()) + nodes = {'oneOf': [obj({'id': NAME, 'type': const(kind), 'definition_version': integer(1), + 'parameters': params}) for kind, params in stages.items()]} + properties = {'schema_version': const(1), 'mode': const('real'), 'id': ID, 'revision': integer(1), + 'name': text(120), 'recipe_version': const(1), 'recipe': const(recipe), + 'nodes': array(nodes, 10, 1), 'edges': array(obj({k: NAME for k in ('from', 'output', 'to', 'input')}), 12), + 'layout': {'type': 'object', 'maxProperties': 10, 'propertyNames': NAME, + 'additionalProperties': obj({k: {'type': 'number', 'minimum': -10000, 'maximum': 10000} for k in ('x', 'y')})}} + required = [k for k in properties if k != 'layout' and not (k == 'recipe' and recipe == 'image_classification')] + variants.append(obj(properties, required)) + return {'oneOf': variants} + + +ANNOTATIONS = { + 'image_detection': obj({'boxes': array(obj({'label': text(80), 'x': {'type': 'number', 'minimum': 0}, + 'y': {'type': 'number', 'minimum': 0}, 'width': {'type': 'number', 'exclusiveMinimum': 0}, + 'height': {'type': 'number', 'exclusiveMinimum': 0}}), 500)}), + 'image_classification': obj({'label': text(80)}), 'image_caption': obj({'caption': text(4000)}), + 'text_classification': obj({'label': text(80)}), + 'text_entities': obj({'spans': array(obj({'label': text(80), 'start': integer(), 'end': integer(1)}), 500)}), + 'text_corpus': obj({'note': text(4000)}), + 'audio_timed': obj({'segments': array(obj({'start_frame': integer(), 'end_frame': integer(1), 'channel': integer(), + 'transcript': text(4000, True), 'label': text(80, True), 'speaker': text(120, True)}), 200, 1)}), + **{kind: obj({'note': text(4000, True)}) for kind in ('sequence_transport', 'mesh_geometry', + 'pointcloud_geometry', 'volume_grid', 'field_sequence_fields')}, +} +OUTPUT_SCHEMA = obj({'status': integer(100, 599), 'result': {}}) +_OPERATIONS = [] + + +def register(name, method, path, properties=None, required=None, *, schema=None, scopes=('inspect',), + mutation=False, query=(), injected=None, description=None, binary=()): + _OPERATIONS.append({'operation_id': name, 'mcp_name': name.replace('.', '_'), + 'description': description or name.replace('.', ' ').replace('_', ' ') + '; existing domain authorization and validation apply.', + 'method': method, 'path': path, 'inputSchema': dict(schema, type='object') if schema else obj(properties, required), + 'outputSchema': OUTPUT_SCHEMA, 'scopes': list(scopes), 'side_effects': mutation, + 'query': list(query), 'injected': injected or {}, 'binary_fields': list(binary)}) + + +for name, path in [('context.get', 'workspace/context'), ('identity.get', 'access/session'), + ('projects.list', 'workspace/projects'), ('recipes.list', 'workspace/definitions'), + ('releases.list', 'workspace/releases'), ('releases.inputs', 'workbench/releases/input-candidates'), + ('graphs.list', 'workspace/graphs'), ('runs.list', 'workspace/runs'), + ('run_inputs.list', 'workspace/run-artifact-inputs')]: + register(name, 'GET', '/api/' + path) +register('projects.get', 'GET', '/api/workspace/projects/{project_id}', {'project_id': ID}) +register('projects.open', 'POST', '/api/workspace/projects', {'root': text(160), 'manifest_path': text(512)}, scopes=('inspect', 'edit'), mutation=True) +register('projects.evidence', 'GET', '/api/workspace/projects/{project_id}/evidence/{reference_id}', {'project_id': ID, 'reference_id': REF}) +register('recipes.inspect', 'GET', '/api/workspace/projects/{project_id}/recipes/{reference_id}', + {'project_id': ID, 'reference_id': REF, 'expected_sha256': SHA}, query=('expected_sha256',)) +register('data.query', 'GET', '/api/workbench/records', { + 'q': text(200, True), 'kind': {'enum': ['', 'image', 'text', 'sequence', 'mesh', 'audio', 'pointcloud', 'volume', 'field_sequence']}, + 'review': {'enum': ['', 'draft', 'human_reviewed', 'programmatically_verified']}, + 'sort': {'enum': ['', 'newest', 'oldest', 'name', 'review']}, 'task': {'enum': ['', *ANNOTATIONS]}, + 'label': text(80, True), 'group': text(120, True), 'rights': text(1000, True), 'offset': integer(), 'limit': integer(1, 100)}, + required=[], query=('q', 'kind', 'review', 'sort', 'task', 'label', 'group', 'rights', 'offset', 'limit')) +for name, path in [('get', 'records'), ('history', 'history'), ('audio', 'audio-inspection'), ('mesh', 'mesh-inspection'), ('pointcloud', 'pointcloud-inspection')]: + register('data.' + name, 'GET', '/api/workbench/' + path + '/{record_id}', {'record_id': ID}) +for name in ('responses', 'preferences'): + register('data.' + name, 'GET', '/api/workbench/records/{record_id}/' + name, {'record_id': ID}) +register('data.volume', 'GET', '/api/workbench/volume-inspection/{record_id}', {'record_id': ID, 'axis': {'enum': ['x', 'y', 'z']}, 'index': integer()}, required=['record_id'], query=('axis', 'index')) +register('data.scientific', 'GET', '/api/workbench/records/{record_id}/scientific', {'record_id': ID, 'axis': {'enum': ['x', 'y', 'z']}, 'index': integer(), 'frame': integer(), 'field': text(120)}, required=['record_id'], query=('frame', 'field', 'axis', 'index')) +for kind in ('image', 'text'): + field = 'image' if kind == 'image' else 'text' + value = B64 if kind == 'image' else text(200000) + register('data.import_' + kind, 'POST', '/api/workbench/import', {field: value, **OPTIONAL_META}, + required=[field, 'groups'], scopes=('inspect', 'edit'), mutation=True, injected={'kind': kind}, binary=[field] if kind == 'image' else []) +register('data.import_audio', 'POST', '/api/workbench/audio-import', {'wav': B64, **OPTIONAL_META}, required=['wav', 'groups'], scopes=('inspect', 'edit'), mutation=True, binary=['wav']) +for kind, names in [('mesh', ('mesh.ply', 'mesh.json')), ('pointcloud', ('points.ply', 'points.json')), ('volume', ('volume.npy', 'volume.json'))]: + register('data.import_' + kind, 'POST', '/api/workbench/' + kind + '-import', {'files': obj({name: B64 for name in names}), **OPTIONAL_META}, required=['files', 'groups'], scopes=('inspect', 'edit'), mutation=True, binary=['files']) +register('data.import_sequence', 'POST', '/api/workbench/sequence-import', {'files': {'oneOf': [obj({name: B64 for name in names}) for names in [('run.json', 'frames.jsonl'), ('run.json', 'frames.jsonl', 'controls.json')]]}, **OPTIONAL_META}, required=['files', 'groups'], scopes=('inspect', 'edit'), mutation=True, binary=['files']) +for kind, path, ids in [('project', '/api/workspace/projects/{project_id}/import-data/{reference_id}', {'project_id': ID, 'reference_id': REF}), + ('run', '/api/workspace/runs/{run_id}/import-data/{artifact_name}', {'run_id': ID, 'artifact_name': ARTIFACT})]: + register('data.import_' + kind + '_scientific', 'POST', path, {**ids, 'expected_sha256': SHA, **OPTIONAL_META}, required=[*ids, 'expected_sha256'], scopes=('inspect', 'edit'), mutation=True) +register('data.save_draft', 'POST', '/api/workbench/records/{record_id}', schema={'oneOf': [obj({ + 'record_id': ID, 'revision': integer(), 'source_revision': integer(), 'task': const(task), 'annotation': annotation, + 'groups': GROUPS, 'review': const('draft')}) for task, annotation in ANNOTATIONS.items()]}, scopes=('inspect', 'edit'), mutation=True) +register('responses.save_draft', 'POST', '/api/workbench/responses', {'id': ID, 'prompt_id': ID, 'revision': integer(), + 'parent_revision': integer(), 'source_revision': integer(), 'completion': text(200000), 'review': const('draft')}, scopes=('inspect', 'edit'), mutation=True) +for family, path in [('caption', 'caption-proposals'), ('classification', 'text-classification-proposals')]: + register('proposals.'+family+'_list', 'GET', '/api/workbench/'+path) + register('proposals.'+family+'_get', 'GET', '/api/workbench/'+path+'/{job_id}', {'job_id': ID}) + fields = {'job_id': ID, 'revision': integer(), 'decision': {'enum': ['reject', 'apply_draft']}} + if family == 'classification': + fields['labels'] = array(text(80), 30, 1) + register('proposals.'+family+'_decide', 'POST', '/api/workbench/'+path+'/decide/{job_id}', fields, + required=['job_id', 'revision', 'decision'], scopes=('inspect', 'edit'), mutation=True) +release = {'items': array(obj({'id': ID, 'revision': integer(), 'source_revision': integer()}), 5000, 1), + 'ratios': obj({key: integer(0, 100) for key in ('train', 'validation', 'test')}), 'seed': integer(0, 2**32-1), + 'format': const('canonical_v1'), 'preview_token': SHA} +register('releases.preview', 'POST', '/api/workbench/releases/preview', release, required=['items', 'ratios', 'seed']) +register('releases.freeze', 'POST', '/api/workbench/releases', release, required=['items', 'ratios', 'seed', 'preview_token'], scopes=('inspect', 'freeze'), mutation=True) +register('graphs.get', 'GET', '/api/workspace/graphs/{graph_id}', {'graph_id': ID}) +register('graphs.create', 'POST', '/api/workspace/graphs', {'name': text(120), 'release_id': SHA, 'recipe': {'enum': RECIPES}}, required=['name', 'release_id'], scopes=('inspect', 'edit'), mutation=True) +register('graphs.create_external', 'POST', '/api/workspace/graphs/external', {'name': text(120), 'project_id': ID, + 'recipe_id': REF, 'expected_sha256': SHA, 'inputs': BINDINGS, 'parameters': PARAMETERS}, required=['name', 'project_id', 'recipe_id', 'expected_sha256', 'inputs'], scopes=('inspect', 'edit'), mutation=True) +register('graphs.save', 'POST', '/api/workspace/graphs/{graph_id}', {'graph_id': ID, 'revision': integer(1), 'document': graph_schema()}, scopes=('inspect', 'edit'), mutation=True) +register('graphs.clone', 'POST', '/api/workspace/graphs/{graph_id}/clone', {'graph_id': ID, 'name': text(120)}, scopes=('inspect', 'edit'), mutation=True) +for name in ('validate', 'preflight_external'): + register('graphs.'+name, 'POST', '/api/workspace/graphs/{graph_id}/'+name.replace('_', '-'), {'graph_id': ID, 'revision': integer(1)}) +for name, suffix in [('get', ''), ('progress', '/progress')]: + register('runs.'+name, 'GET', '/api/workspace/runs/{run_id}'+suffix, {'run_id': ID}) +register('runs.predictions', 'GET', '/api/workspace/runs/{run_id}/predictions', {'run_id': ID, 'split': {'enum': ['validation', 'test']}}, required=['run_id'], query=('split',)) +register('runs.submit_external', 'POST', '/api/workspace/runs/submit-external', {'request_key': {'type': 'string', 'pattern': '^[A-Za-z0-9_.:-]{8,128}$'}, 'graph_id': ID, 'graph_revision': integer(1), 'expected_digest': SHA, 'approval_id': ID}, scopes=('inspect', 'execute'), mutation=True, + description='Submit exact owner-granted material. Same request key/body reconciles admission; never creates a grant or automatically retries.') +register('runs.cancel', 'POST', '/api/workspace/runs/{run_id}/cancel', {'run_id': ID}, scopes=('inspect', 'cancel'), mutation=True) +register('runs.expose_test', 'POST', '/api/workspace/runs/{run_id}/expose-test', {'run_id': ID, 'reason': text(500)}, scopes=('inspect', 'expose-holdout'), mutation=True, + description='Irreversibly record disclosure of held-out classifier test results. Explicit expose-holdout scope required; non-idempotent, no automatic retry.') +register('runs.artifact_chunk', 'POST', '/api/workspace/runs/{run_id}/artifact-segment/{name}', {'run_id': ID, 'name': ARTIFACT, 'expected_sha256': SHA, 'offset': integer(), 'max_bytes': integer(1, 8*1024*1024)}, + description='Read a bounded artifact segment; verify final reassembled whole SHA256 before use. Segment hash does not verify the whole artifact.') + + +def projected(properties): + """Validate top-level domain shape; preserve unknown owned nested evidence.""" + return {'type': 'object', 'properties': properties, 'required': list(properties), 'additionalProperties': True} + + +SEGMENT_SCHEMA = obj({'run_id': ID, 'name': ARTIFACT, 'expected_sha256': SHA, + 'total_bytes': integer(0, 512*1024*1024), 'media_type': const('application/octet-stream'), + 'offset': integer(0, 512*1024*1024), 'bytes': integer(0, 8*1024*1024), + 'next_offset': integer(0, 512*1024*1024), 'eof': {'type': 'boolean'}, 'segment_sha256': SHA, + 'data_base64': {'type': 'string', 'maxLength': 4*((8*1024*1024+2)//3), 'pattern': '^[A-Za-z0-9+/]*={0,2}$'}, + 'verification': const('segment_read_whole_hash_unverified')}) +_LIST = {'type': 'array'} +_RECORD = projected({'id': ID, 'revision': integer(), 'kind': {'type': 'string'}}) +_GRAPH = projected({'id': ID, 'revision': integer(1), 'nodes': _LIST, 'edges': _LIST}) +_RUN = projected({'id': ID, 'state': {'type': 'string'}}) +_SHAPES = { + 'context.get': projected({'dataset_id': ID, 'mode': const('real')}), + 'identity.get': projected({'catalog_id': ID, 'actor_id': ID, 'kind': const('agent'), 'scopes': _LIST}), + 'projects.list': projected({'projects': _LIST, 'roots': _LIST}), + 'projects.get': projected({'id': ID, 'manifest_sha256': SHA}), + 'projects.open': projected({'id': ID, 'manifest_sha256': SHA}), + 'projects.evidence': projected({'id': REF, 'text': {'type':'string'}, 'sha256': SHA}), + 'recipes.list': projected({'recipes': _LIST, 'schema_version': const(1)}), + 'recipes.inspect': projected({'definition': {'type':'object'}, 'receipt': {'type':'object'}, 'parameter_definitions': {'type':'object'}}), + 'data.query': projected({'items': _LIST, 'total': integer(), 'offset': integer(), 'limit': integer(1,100)}), + 'data.get': _RECORD, 'data.history': _LIST, + 'data.responses': projected({'parent': _RECORD, 'responses': _LIST}), + 'data.preferences': projected({'parent': _RECORD, 'responses': _LIST, 'judgments': _LIST}), + 'data.save_draft': _RECORD, + 'responses.save_draft': projected({'response': projected({'id': ID, 'prompt_id': ID, 'revision': integer()}), 'parent': _RECORD, 'changed': {'type':'boolean'}}), + 'releases.list': _LIST, 'releases.inputs': projected({'releases': _LIST}), + 'releases.preview': projected({'eligible': {'type':'boolean'}, 'blockers': _LIST}), + 'releases.freeze': projected({'id': SHA, 'url': {'type':'string'}, 'records': integer()}), + 'graphs.list': _LIST, 'graphs.get': _GRAPH, 'graphs.create': _GRAPH, 'graphs.create_external': _GRAPH, + 'graphs.save': _GRAPH, 'graphs.clone': _GRAPH, + 'graphs.validate': projected({'valid': {'type':'boolean'}, 'errors': _LIST}), + 'graphs.preflight_external': projected({'valid': {'type':'boolean'}, 'material_sha256': SHA, 'material': {'type':'object'}}), + 'run_inputs.list': projected({'runs': _LIST}), 'runs.list': _LIST, 'runs.get': _RUN, + 'runs.submit_external': _RUN, 'runs.cancel': _RUN, + 'runs.progress': projected({'run_id': ID, 'state': {'type':'string'}, 'evidence': {'type':'string'}}), + 'runs.predictions': projected({'rows': _LIST}), + 'runs.expose_test': projected({'id': ID, 'run_id': ID, 'release_id': SHA, 'reason': text(500), + 'test_exposure': obj({'exposed': const(True), 'event_count': integer(1)})}), + 'runs.artifact_chunk': SEGMENT_SCHEMA, +} +for _kind in ('audio','mesh','pointcloud','volume','scientific'): + _SHAPES['data.'+_kind] = projected({'id': ID, 'content_hash': SHA}) +for _op in _OPERATIONS: + _name = _op['operation_id'] + if _name.startswith('data.import_'): + _SHAPES[_name] = _RECORD + if _name.startswith('proposals.'): + _SHAPES[_name] = (projected({'jobs': _LIST}) if _name.endswith('_list') else + projected({'job': {'type':'object'}, 'changed': {'type':'boolean'}}) if _name.endswith('_decide') else + projected({'id': ID, 'status': {'type':'string'}})) + _op['outputSchema'] = {'type':'object', 'oneOf': [ + obj({'status': integer(200,299), 'result': _SHAPES[_name]}), + obj({'status': integer(400,599), 'result': obj({'error': text(1000), 'code': text(120)}, required=['error'])})]} + + +EXCLUSIONS = ['owner review and execution grants', 'credential administration', 'provider/model discovery or execution', + 'ordinary run submit/retry', 'backup/restore/runtime snapshots', 'bulk native import workflows', + 'saved search/selection mutations', 'alternate release projections', 'arbitrary files/URLs', 'non-Run binary download tools'] +LIMITS = {'request_bytes': REQUEST_LIMIT, 'http_response_bytes': RESPONSE_LIMIT, 'mcp_response_bytes': MCP_RESPONSE_LIMIT, + 'inline_decoded_bytes': INLINE_LIMIT, 'json_depth': DEPTH_LIMIT, 'artifact_segment_bytes': 8*1024*1024} +_PAYLOAD = {'version': REGISTRY_VERSION, 'operations': _OPERATIONS, 'limits': LIMITS, 'exclusions': EXCLUSIONS} +REGISTRY_DIGEST = hashlib.sha256(encoded(_PAYLOAD)).hexdigest() +_LOOKUP = {key: operation for operation in _OPERATIONS for key in (operation['operation_id'], operation['mcp_name'])} + + +def discovery(): + return copy.deepcopy(dict(_PAYLOAD, digest=REGISTRY_DIGEST)) + + +def tool_definitions(): + return [{'name': op['mcp_name'], 'description': op['description'] + ' Required scopes: ' + ', '.join(op['scopes']) + '.', 'inputSchema': copy.deepcopy(op['inputSchema']), + 'outputSchema': copy.deepcopy(op['outputSchema']), 'annotations': {'readOnlyHint': not op['side_effects'], + 'destructiveHint': op['side_effects'], 'idempotentHint': False, 'openWorldHint': op['operation_id'] == 'runs.submit_external'}} for op in _OPERATIONS] + + +def operation(name): + if type(name) is not str or name not in _LOOKUP: + raise AgentAPIError('Unknown agent operation.', 'unknown_operation') + return copy.deepcopy(_LOOKUP[name]) + + +def _finite(value, depth=0): + if depth > DEPTH_LIMIT: + raise AgentAPIError('JSON nesting exceeds the transport bound.') + if isinstance(value, str): + if any(0xD800 <= ord(ch) <= 0xDFFF for ch in value) or '\x00' in value: + raise AgentAPIError('Text contains an invalid code point.') + elif isinstance(value, float) and not math.isfinite(value): + raise AgentAPIError('JSON numbers must be finite.') + elif isinstance(value, dict): + for key, child in value.items(): + if type(key) is not str: + raise AgentAPIError('JSON object keys must be strings.') + _finite(key, depth+1); _finite(child, depth+1) + elif isinstance(value, list): + for child in value: + _finite(child, depth+1) + elif value is not None and type(value) not in (bool, int, float): + raise AgentAPIError('Unsupported JSON value.') + + +def decode(raw): + def pairs(items): + result = {} + for key, value in items: + if key in result: + raise AgentAPIError('Duplicate JSON field.') + result[key] = value + return result + try: + value = json.loads(raw, object_pairs_hook=pairs, parse_constant=lambda _value: (_ for _ in ()).throw(ValueError())) + _finite(value) + return value + except (ValueError, UnicodeError, RecursionError): + raise AgentAPIError('Invalid bounded JSON.') from None + + +def _validator(schema): + try: + from jsonschema import Draft202012Validator + except ImportError: + raise AgentAPIError('Install the documented optional agent dependencies.', 'dependency_missing', 503) from None + # Checked-in schemas contain no references; no network/file retrieval exists. + def check(value): + if isinstance(value, dict): + if '$ref' in value or '$dynamicRef' in value: + raise AgentAPIError('Registry references are unsupported.', 'registry_invalid', 503) + for child in value.values(): + check(child) + elif isinstance(value, list): + for child in value: + check(child) + check(schema) + Draft202012Validator.check_schema(schema) + return Draft202012Validator(schema) + + +def validate_registry(): + for op in _OPERATIONS: + _validator(op['inputSchema']) + _validator(op['outputSchema']) + return REGISTRY_DIGEST + + +def validate_output(name, envelope): + _finite(envelope) + if next(_validator(operation(name)['outputSchema']).iter_errors(envelope), None) is not None: + raise AgentAPIError('HTTP result does not match its operation envelope.', 'transport', 502) + return envelope + + +def validate_arguments(name, arguments): + op = operation(name) + _finite(arguments) + if len(encoded(arguments)) > REQUEST_LIMIT: + raise AgentAPIError('Request exceeds the agent transport bound.', 'too_large', 413) + if next(_validator(op['inputSchema']).iter_errors(arguments), None) is not None: + raise AgentAPIError('Arguments do not match the operation schema.') + total = 0 + for key in op['binary_fields']: + value = arguments[key] + values = value.values() if isinstance(value, dict) else [value] + for entry in values: + try: + total += len(base64.b64decode(entry, validate=True)) + except (ValueError, binascii.Error): + raise AgentAPIError('Invalid base64 import bytes.') from None + if total > INLINE_LIMIT: + raise AgentAPIError('Inline import exceeds 512 KiB; use the supported HTTP/UI or scientific references.', 'too_large', 413) + if op['operation_id'] == 'graphs.save' and len(json.dumps(arguments['document'], ensure_ascii=False, sort_keys=True, separators=(',', ':'), allow_nan=False).encode('utf-8')) > 32768: + raise AgentAPIError('Graph exceeds the 32 KiB bound.', 'too_large', 413) + return copy.deepcopy(arguments) + + +def project_request(name, arguments): + op = operation(name) + arguments = validate_arguments(name, arguments) + segments = re.findall(r'\{([^}]+)\}', op['path']) + path = op['path'] + for key in segments: + path = path.replace('{'+key+'}', quote(arguments[key], safe='')) + query = {key: arguments[key] for key in op['query'] if key in arguments} + if query: + path += '?' + urlencode(query) + body = {key: value for key, value in arguments.items() if key not in segments and key not in op['query']} + body.update(op['injected']) + return op['method'], path, body if op['method'] != 'GET' else None + + +def _private_file(path, maximum): + fd = None + try: + path = Path(path) + if not path.is_absolute() or '..' in path.parts: + raise ValueError() + directory = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in path.parts[1:-1]: + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=directory) + os.close(directory); directory = child + fd = os.open(path.name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=directory) + finally: + os.close(directory) + info = os.fstat(fd) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1 or info.st_uid != os.getuid() or info.st_mode & 0o077 or not 0 < info.st_size <= maximum: + raise ValueError() + raw = os.read(fd, maximum+1) + after = os.fstat(fd) + if len(raw) != info.st_size or (info.st_size, info.st_mtime_ns, info.st_ctime_ns) != (after.st_size, after.st_mtime_ns, after.st_ctime_ns): + raise ValueError() + return raw + except (OSError, ValueError, TypeError): + raise AgentAPIError('Use an owned private regular configuration/token file.', 'configuration') from None + finally: + if fd is not None: + os.close(fd) + + +class AgentClient: + """No catalog access, automatic retries, redirects, proxies or owner identity.""" + def __init__(self, endpoint, token, expected_catalog_id, timeout=120): + try: + parsed = urlsplit(endpoint) + if (parsed.scheme != 'http' or parsed.hostname not in ('127.0.0.1', '::1') or parsed.username is not None + or parsed.password is not None or parsed.path not in ('', '/') or parsed.query or parsed.fragment + or parsed.port is None or not 1 <= parsed.port <= 65535 or any(ch.isspace() for ch in endpoint)): + raise ValueError() + if not re.fullmatch(r'[A-Za-z0-9_-]{20,4096}', token) or not re.fullmatch('[a-f0-9]{32}', expected_catalog_id): + raise ValueError() + if type(timeout) not in (int, float) or not math.isfinite(timeout) or not 0 < timeout <= 300: + raise ValueError() + except (ValueError, TypeError): + raise AgentAPIError('Invalid fixed loopback client configuration.', 'configuration') from None + self.host, self.port = parsed.hostname, parsed.port + self._token, self.catalog_id, self.timeout = token, expected_catalog_id, timeout + self._ready = False + + @classmethod + def from_config(cls, path): + config = decode(_private_file(path, 16384)) + if type(config) is not dict or set(config) not in ({'endpoint', 'catalog_id', 'token_file'}, {'endpoint', 'catalog_id', 'token_file', 'timeout'}): + raise AgentAPIError('Configuration requires endpoint, catalog_id and token_file.', 'configuration') + try: + token = _private_file(config['token_file'], 4096).decode('ascii').strip() + except (UnicodeError, TypeError): + raise AgentAPIError('Invalid private credential file.', 'configuration') from None + return cls(config['endpoint'], token, config['catalog_id'], config.get('timeout', 120)) + + def _request(self, method, path, body=None): + connection = http.client.HTTPConnection(self.host, self.port, timeout=min(5, self.timeout)) + deadline = time.monotonic() + self.timeout + sockets = [] + response = None + def expire(): + for owned in sockets: + try: + owned.shutdown(socket.SHUT_RDWR) + except OSError: + pass + timer = threading.Timer(self.timeout, expire) + timer.daemon = True + timer.start() + try: + raw = encoded(body) if body is not None else None + if raw is not None and len(raw) > REQUEST_LIMIT: + raise AgentAPIError('Request exceeds the agent transport bound.', 'too_large', 413) + headers = {'Authorization': 'Bearer '+self._token, 'Accept': 'application/json', 'Accept-Encoding': 'identity', 'Connection': 'close'} + if raw is not None: + headers['Content-Type'] = 'application/json' + connection.connect() + sockets.append(connection.sock) + remaining = deadline - time.monotonic() + if remaining <= 0: + raise TimeoutError() + # A preflight may produce no headers for >5s. The independent timer + # bounds this entire phase, including a peer trickling header bytes. + connection.sock.settimeout(remaining) + connection.request(method, path, body=raw, headers=headers) + response = connection.getresponse() + if 300 <= response.status < 400: + raise AgentAPIError('Redirects are not supported.', 'transport', 502) + lengths = response.headers.get_all('Content-Length', []) + if (len(lengths) != 1 or len(lengths[0]) > 10 or not re.fullmatch('[0-9]+', lengths[0]) + or response.getheader('Transfer-Encoding') is not None + or response.getheader('Content-Encoding', 'identity') != 'identity' + or response.getheader('Content-Type', '').split(';')[0].strip() != 'application/json'): + raise AgentAPIError('HTTP response framing or content type is unsupported.', 'transport', 502) + length = int(lengths[0]) + if length > RESPONSE_LIMIT: + raise AgentAPIError('HTTP response exceeds the agent receive bound.', 'response_too_large', 413) + data = bytearray() + while len(data) < length: + remaining = deadline - time.monotonic() + if remaining <= 0: + raise TimeoutError() + # getresponse may detach the connection socket (Connection:close). + sockets[0].settimeout(min(5, remaining)) + chunk = response.read1(min(65536, length-len(data))) + if not chunk: + raise AgentAPIError('HTTP response ended before its declared length.', 'transport', 502) + data.extend(chunk) + if time.monotonic() > deadline: + raise TimeoutError() + value = decode(data) + if response.status >= 400: + if not isinstance(value, dict) or not isinstance(value.get('error'), str): + raise AgentAPIError('Malformed HTTP error response.', 'transport', 502) + code = value.get('code', 'http_error') + if (type(code) is not str or not re.fullmatch('[a-z][a-z0-9_]{0,79}', code) + or self._token in code): + raise AgentAPIError('Malformed HTTP error code.', 'transport', 502) + value = {'code': code, 'error': value['error'].replace(self._token, '[redacted]')[:1000]} + return {'status': response.status, 'result': value} + except AgentAPIError: + raise + except (OSError, http.client.HTTPException, TimeoutError): + raise AgentAPIError('Local HTTP request failed; inspect durable state before retrying a mutation.', 'transport', 503) from None + finally: + timer.cancel() + if response is not None: + response.close() + connection.close() + for owned in sockets: + owned.close() + timer.join(timeout=1) + + def _check_discovery(self): + envelope = self._request('GET', '/api/agent/operations') + remote = envelope['result'] + if envelope['status'] != 200: + if envelope['status'] >= 400: + raise AgentAPIError(remote['error'], remote['code'], envelope['status']) + raise AgentAPIError('Unexpected discovery response status.', 'transport', 502) + if not isinstance(remote, dict) or remote != discovery(): + raise AgentAPIError('Server and bridge operation registries differ.', 'registry_mismatch', 409) + + def bootstrap(self): + validate_registry() + identity = self._request('GET', '/api/access/session') + value = identity['result'] + if identity['status'] != 200 or not isinstance(value, dict) or value.get('kind') != 'agent' or value.get('catalog_id') != self.catalog_id: + raise AgentAPIError('Use an active agent credential for the configured catalog.', 'unauthenticated', 401) + context = self._request('GET', '/api/workspace/context') + if context['status'] != 200 or not isinstance(context['result'], dict) or context['result'].get('dataset_id') != self.catalog_id: + raise AgentAPIError('Configured catalog does not match HTTP service.', 'catalog_mismatch', 409) + self._check_discovery() + self._ready = True + return {'identity': value, 'discovery': discovery()} + + def call(self, name, arguments): + op = operation(name) + method, path, body = project_request(name, arguments) + if not self._ready: + self.bootstrap() + if op['side_effects']: + self._check_discovery() + result = validate_output(name, self._request(method, path, body)) + if op['operation_id'] == 'runs.artifact_chunk' and result['status'] < 400: + validate_segment(result['result'], arguments) + return result + + +def dispatch(client, name, arguments): + return client.call(name, arguments) + + +def validate_segment(value, request): + """Check one returned segment, never claim its unobserved whole-file hash.""" + try: + raw = base64.b64decode(value['data_base64'], validate=True) + if (base64.b64encode(raw).decode('ascii') != value['data_base64'] + or any(value[key] != request[key] for key in ('run_id','name','expected_sha256','offset')) + or len(raw) != value['bytes'] or len(raw) > request['max_bytes'] + or value['next_offset'] != value['offset'] + len(raw) + or value['next_offset'] > value['total_bytes'] + or value['eof'] != (value['next_offset'] == value['total_bytes']) + or (not value['eof'] and not raw) + or hashlib.sha256(raw).hexdigest() != value['segment_sha256']): + raise ValueError() + return raw + except (ValueError, KeyError, TypeError, binascii.Error): + raise AgentAPIError('Artifact segment identity, bytes or hash differ.', 'artifact_mismatch', 409) from None + + +def verify_artifact(client, run_id, name, expected_sha256, *, consume=None, chunk_bytes=8*1024*1024): + """Stream into an optional caller callback; bytes remain provisional until return. + + This library helper opens no files and is not a separate MCP operation. + A caller must discard provisional outputs on any exception. + """ + offset, total, checksum = 0, None, hashlib.sha256() + while True: + request = dict(run_id=run_id, name=name, expected_sha256=expected_sha256, offset=offset, max_bytes=chunk_bytes) + envelope = client.call('runs.artifact_chunk', request) + if envelope['status'] >= 400: + raise AgentAPIError('Artifact read was refused; discard provisional bytes.', 'artifact_unavailable', envelope['status']) + value = envelope['result'] + raw = validate_segment(value, request) + if total is not None and total != value['total_bytes']: + raise AgentAPIError('Artifact size changed between segments.', 'artifact_mismatch', 409) + total = value['total_bytes'] + checksum.update(raw) + if consume is not None: + consume(raw) + offset = value['next_offset'] + if value['eof']: + if checksum.hexdigest() != expected_sha256 or offset != total: + raise AgentAPIError('Whole artifact SHA256 differs; discard provisional bytes.', 'artifact_mismatch', 409) + return {'sha256': expected_sha256, 'bytes': total, 'verification': 'whole_sha256_verified'} diff --git a/app.py b/app.py index d749b2b5..d68a102b 100644 --- a/app.py +++ b/app.py @@ -28,6 +28,7 @@ import pipeline import projects import access +import agent_api from access import authorized from http.cookies import SimpleCookie, CookieError import runs @@ -572,6 +573,8 @@ def do_POST(self): def _get(self): path = urlsplit(self.path).path try: + if path == '/api/agent/operations': + return self.reply(agent_api.discovery()) if path == '/api/workspace/projects' or path.startswith('/api/workspace/projects/'): self.project_access() if path.startswith('/api/workspace/'): @@ -781,7 +784,7 @@ def _post(self): if not 0 < length <= limit: raise ValueError('Request is too large or empty.') raw_body = self.rfile.read(length) - body = projects.decode(raw_body) if (path == '/api/workspace/projects' or path.startswith('/api/workspace/projects/') or (path.startswith('/api/workspace/runs/') and '/import-data/' in path)) else spatial_assets.parse_request(raw_body) if path in ('/api/workbench/pointcloud-import', '/api/workbench/volume-import') else native_detection_import.parse_request(raw_body) if path in ('/api/workbench/native-detection-import/prepare', '/api/workbench/native-detection-import/row') else saved_searches.parse_request(raw_body) if path == '/api/workbench/searches' or path.startswith('/api/workbench/searches/') else sequence_batch_import.parse_request(raw_body) if path in ('/api/workbench/sequence-import', '/api/workbench/sequence-import-item') else meshes.parse_json(raw_body) if path == '/api/workbench/mesh-import' else json.loads(raw_body) + body = projects.decode(raw_body) if (path == '/api/workspace/projects' or path.startswith('/api/workspace/projects/') or (path.startswith('/api/workspace/runs/') and ('/import-data/' in path or '/artifact-segment/' in path))) else spatial_assets.parse_request(raw_body) if path in ('/api/workbench/pointcloud-import', '/api/workbench/volume-import') else native_detection_import.parse_request(raw_body) if path in ('/api/workbench/native-detection-import/prepare', '/api/workbench/native-detection-import/row') else saved_searches.parse_request(raw_body) if path == '/api/workbench/searches' or path.startswith('/api/workbench/searches/') else sequence_batch_import.parse_request(raw_body) if path in ('/api/workbench/sequence-import', '/api/workbench/sequence-import-item') else meshes.parse_json(raw_body) if path == '/api/workbench/mesh-import' else json.loads(raw_body) if not isinstance(body, dict): raise ValueError('Expected an object.') path = urlsplit(self.path).path @@ -800,6 +803,8 @@ def _post(self): admission = {key: value for key, value in body.items() if key != 'expected_sha256'} return self.reply(dataset.workbench.scientific.admit_run_artifact( parts[1], parts[3], body['expected_sha256'], admission), 201) + if len(parts) == 4 and parts[0] == 'runs' and parts[2] == 'artifact-segment': + return self.reply(dataset.runs.artifact_segment(parts[1], parts[3], body)) if parts == ['graphs']: return self.reply(dataset.pipelines.create(body), 201) if parts == ['graphs', 'external']: diff --git a/docs/contracts/agent-operations.md b/docs/contracts/agent-operations.md new file mode 100644 index 00000000..c4536d74 --- /dev/null +++ b/docs/contracts/agent-operations.md @@ -0,0 +1,130 @@ +# Scoped local agent operations v1 + +`agent_api.discovery()` is the versioned operation registry. Its deterministic +SHA256 binds schemas, route projections, scope descriptions and limits. The +application exposes it at authenticated `GET /api/agent/operations` without +importing optional packages. MCP uses the same definitions with fixed underscore +names; dotted operation IDs remain stable registry identifiers. These schemas +bound transport input; current HTTP/domain owners decide source custody, +permissions, revisions, family independence and execution eligibility. + +## Configuration and authority + +The optional bridge reads `--config /absolute/private/config.json`. The closed +configuration has `endpoint`, `catalog_id`, `token_file`, and optional `timeout`. +Endpoint must be explicit `http://127.0.0.1:PORT` or `http://[::1]:PORT`. +Configuration and token files must be owned regular files, private to the current +user, without symlinks or hard links. Token path is absolute; credential contents +are never CLI arguments or logs. Bootstrap requires a live agent credential and +matching catalog and registry. Mutations recheck authenticated discovery. Its HTTP authorization failures keep +the original validated status/code/message; registry_mismatch is reserved for a +successful discovery response whose registry differs. No +redirects, proxies, host discovery, arbitrary URLs, shell, catalog connection, +scheduler, credential issuance or automatic mutation retries exist in the bridge. + +An owner prepares credentials, human reviews and exact execution grants through +existing HTTP/UI. Agent draft tools cannot claim human/programmatic review. +External submit requires the exact approval ID, graph revision, material digest +and request key. Identical-key receipt reconciliation is distinct from a new +attempt. Ordinary submit/retry remains owner-only and unexposed. Explicit test +exposure is supported with `expose-holdout`, not an owner-only fiction: it records +irreversible disclosure through the existing owner, has no preview/grant field, +and is not idempotent. A lost acknowledgement requires state inspection. + +## Supported matrix + +The registry is the machine-readable exact field/schema inventory: + +| Operations | Existing domain surface | +| --- | --- | +| context.get, identity.get | workspace context and authenticated identity | +| projects.list/get/open/evidence | configured project roots and bounded declared evidence | +| recipes.list/inspect | recipe declarations, exact expected recipe SHA | +| data.query/get/history/responses/preferences | all eight record kinds, existing metadata/history | +| data.audio/mesh/pointcloud/volume/scientific | existing bounded typed inspections/slices | +| data.import_image/text/audio/mesh/sequence/pointcloud/volume | bounded exact native imports | +| data.import_project_scientific/import_run_scientific | hash-bound existing owner reference capture | +| data.save_draft, responses.save_draft | CAS draft targets; all twelve annotation tasks | +| proposals.caption_list/get/decide, proposals.classification_list/get/decide | existing owner-started proposal reads and reject/apply_draft | +| releases.list/inputs/preview/freeze | canonical_v1 selection/family/review authority | +| graphs.list/get/create/create_external/save/clone/validate/preflight_external | known graph variants; disconnected drafts allowed, preflight canonical | +| run_inputs.list, runs.list/get/progress/predictions | current Run custody/progress/result projections | +| runs.submit_external/cancel/expose_test | exact granted execution, scoped cancellation/disclosure | +| runs.artifact_chunk | bounded stateless segment of a completed external Run artifact | + +Registry restrictions narrower than HTTP are explicit: canonical freeze requires +preview_token; draft annotations only; graph edits describe known node parameter +variants rather than arbitrary future types; inline import bytes are at most +512 KiB aggregate and request at most1 MiB. Larger scientific references use +existing Project/Run capture limits, not client filesystem access. Sequence v1 +requires run.json/frames.jsonl; v2 additionally controls.json. All file payloads, including image, +are original raw base64 (not image data URLs); no scientific conversion occurs in the transport. + +Unexposed: owner review/grant/admin operations, providers/model execution, +ordinary run submit/retry, backup/restore/snapshots, bulk native import workflows, +saved-search/selection mutations, alternate export formats and general binary +asset/release downloads. Project evidence DOES have its existing HTTP route; +`projects.evidence` invokes it. Metadata parity does not promise binary rendering. + +## Limits and errors + +Optional schema validation uses the standard pinned jsonschema +Draft202012Validator, with no custom type checker or external schema retrieval. +Standard integer schemas reject bool but admit integral floats. Existing domain +owners may require actual Python integers and reject those floats; the bridge +forwards the original value without conversion. Schema validity is not domain +acceptance. App registry imports remain stdlib-only. +Strict JSON rejects duplicate fields, nonfinite numbers, surrogates/NUL and depth +above64. No trimming/coercion occurs during forwarding; owners retain semantics. + +Default absolute HTTP deadline is120 seconds (configuration maximum300). Connect +is at most5 seconds. Header wait may use the remaining absolute deadline because +preflight can take longer than5 seconds before replying; a separate deadline +socket shutdown prevents header trickle extending the call. Payload blocks use +at most5 seconds or remaining deadline. This deliberately supersedes any draft +claim of a5-second complete header phase. Every call closes its own socket/timer. + +HTTP receive bound16 MiB and MCP encoded response bound32 MiB are client limits, +not existing global server caps. Large list/detail responses can exceed them and +are explicitly refused. Framing requires one Content-Length, JSON identity +encoding, no compression, chunked encoding or redirects. Execution errors retain +bounded safe HTTP status/code/message, returned as `{status,result}`. Unknown tools and registry argument-schema errors return JSON-RPC -32602 +before SDK dispatch. Actual HTTP/domain or transport execution failures return +tool isError with the typed envelope; protocol failures are not tool failures. +Unknown commit is never retried automatically. MCP output schemas describe this +stable envelope; domain result semantics remain with their existing owners. + +## Artifact byte parity + +`runs.artifact_chunk` takes run_id/name/expected_sha256/offset/max_bytes (1..8 MiB). +The existing Runs segment owner verifies receipt/inventory and reads only the +selected interval, returning its hash and explicit whole-hash-unverified status. +Reassemble ordered offsets, verify each segment and verify the final complete +SHA256 against expected_sha256 BEFORE treating bytes as verified evidence or a +checkpoint. Same-size mutation outside the segment is not detected by that read. +No bridge cache, arbitrary output file, fake full verification or Library exists. +The unchanged full HTTP download uses the existing verified anonymous spool. + +An8 MiB chunk encodes to11,184,812 base64 characters; duplicating structuredContent +in compatibility text uses22,369,624 characters plus bounded metadata, within32 MiB. +Other JSON can expand more: the protocol owner checks final encoded response size. +Tests must establish exact multichunk reconstruction and linear payload reads, +revocation and mutation failures, alongside legacy full-download behavior. + +Focused HTTP/MCP workflow and negative coverage passed after the benchmark +gate, as recorded in p6-verification.md. Shared real scientific reads and final +full regression/CI remain separate pending acceptance gates. + +Output schemas check each operation's success top-level kind and identity fields, +and distinguish HTTP error envelopes from successful results. Nested scientific +or runtime documents are preserved as owner evidence, not independently certified +by these schemas. Artifact segment output alone is fully closed and bounded; +client correlation checks echoed Run/name/hash/offset, decoded size and segment +SHA. `verify_artifact` provides bounded whole-file reassembly verification with +an optional caller callback. Callback bytes are provisional until successful +return and must be discarded on error; it never opens a filesystem path. + +Response errors without a legacy code map to `http_error`; malformed/non-string/ +secret-bearing code fields are transport failures. HTTP output objects posing as +success (`200` with only an error body) fail the operation output schema. Raw +tracebacks or arbitrary response formats are not accepted as authoritative errors. diff --git a/docs/plans/generic-scientific-projects/plan.md b/docs/plans/generic-scientific-projects/plan.md index 55e3a497..ad97abad 100644 --- a/docs/plans/generic-scientific-projects/plan.md +++ b/docs/plans/generic-scientific-projects/plan.md @@ -2,9 +2,9 @@ **Plan status:** `Active` -**Current phase:** P5 training and autonomous evaluation qualified. P5c actual scientific, restart, browser and final regression gates passed against PR52 source checkpoint d191e68; see [P5c verification](reports/p5c-verification.md). +**Current phase:** P5 qualified; P6 actual scientific MCP read passed and final test/CI qualification is active. See [P5c](reports/p5c-verification.md) and [P6](reports/p6-verification.md). -**Next slice:** Qualify P6 scoped agent operations and P7 complete database/artifact restore on separate feature branches. Neither milestone is accepted by P5 evidence. +**Next slice:** Finish P6 regression/CI and P7 complete PostgreSQL/artifact restore; acceptance remains partial. **Acceptance status:** `partial` @@ -18,7 +18,7 @@ Open an existing scientific repository as a Tuldok project, acquire lossless dat Use `MrScripty/rheon-surrogate-lab` as the concrete complete acceptance workflow. Wrap its proven generation, modal pressure fitting and autonomous rollout evaluation scripts before considering algorithm replacement. This plan does not promise unrestricted scientific software execution or arbitrary 3D model support. -The user approved publishing this plan and staged implementation on 2026-10-13. Commit/push and draft PR creation are authorized; merge and deployment are not. Start P1 after plan publication and progress to later stages only after their prerequisite gates qualify. G1 is qualified; remaining product gates require their staged evidence. +The user approved publishing this plan and staged implementation on 2026-10-13. Commit/push and draft PR creation are authorized. The later explicit user instruction additionally authorizes merging qualified PRs in dependency order; deployment remains unapproved. Start P1 after plan publication and progress to later stages only after their prerequisite gates qualify. G1 is qualified; remaining product gates require their staged evidence. ## Roadmap continuation @@ -36,7 +36,7 @@ The user approved publishing this plan and staged implementation on 2026-10-13. | G2 | Scientific fields preserve exact float bytes, dimensions, staggered placement, units, time and trajectory identity through import, freeze, download and cold read | contract | representative | automated | satisfied | [Actual native and neutral custody workflows](reports/p2-verification.md) | | G3 | An optional Rheon adapter exposes bounded generation controls and produces real generic scientific data; removing it leaves generic project/data use intact | integration | required-real | automated | satisfied | [P4 actual generation and no-adapter startup](reports/p4-verification.md) | | G4 | Saved graph executes existing lab fitting and autonomous evaluation scripts; verified checkpoint, full-field comparisons and physics diagnostics survive restart with complete provenance | system | required-real | automated | satisfied | [P5b training](reports/p5b-verification.md) and [P5c real evaluation/restart](reports/p5c-verification.md) | -| G5 | Agent and UI clients use the same operations; stale requests, forged human review, unauthorized execution, path escape and approval reuse fail before side effects | contract | representative | automated | pending | P3/P6 public-interface denial and parity tests | +| G5 | Agent and UI clients reach the same domain owners for the admitted bounded matrix and equivalent authority; owner-only review/grants remain separate. Stale requests, forged human review, unauthorized execution, path escape and approval reuse fail before side effects | contract | representative | automated | pending | P3/P6 public-interface denial and parity tests | | G6 | Admission is idempotent; cancel, crash and restart never duplicate work, publish partial success or silently leave descendants running | system | representative | automated | satisfied | [P3 custody and fault tests](reports/p3b-verification.md), retained by final P5 regression | | G7 | Existing imports/releases/runs retain identities and bytes, including Rheon v1/v2; explicit migration and complete PostgreSQL/artifact restore preserve old and new records | integration | representative | automated | pending | P2/P7 retained-history and restore workflow | | G8 | Desktop/narrow/keyboard UI supports open → generate → review/freeze → edit graph → train/evaluate → inspect results without explanatory clutter or false qualification labels | user-workflow | required-real | either | pending | P7 reviewed screenshots and actual-run browser receipt | @@ -228,16 +228,18 @@ Statuses below track the approved staged implementation. Before starting each mi ### P6: Agent domain interface -**Goal:** An agent discovers and controls the qualified workflow through typed domain operations with the same outcomes as the UI. +**Goal:** An agent discovers and controls the qualified workflow through the admitted typed operation matrix, with the same domain outcomes as equivalent authorized HTTP/UI actions. This does not delegate every UI privilege or legacy endpoint. **Allowed write set:** proposed `agent_api.py`, `docs/contracts/agent-operations.md`, versioned operation schemas and a thin local MCP adapter selected/pinned after transport review; existing API/access/domain owners only as needed; public HTTP/MCP integration tests and developer usage documentation. -**Tasks:** Project/data/recipe discovery; queries and typed mutation tools; release preview/freeze; graph editing/preflight; idempotent submit/status/cancel/retry; provenance/artifact access; scoped credential setup/revocation. Tool descriptions identify side effects and approval requirements. Reuse shared validation/errors; no direct DB or file-management tools masquerading as domain operations. +**Tasks:** Implement the admitted matrix: project/data/recipe discovery; bounded queries and typed draft mutations; canonical release preview/freeze; graph editing/preflight; exact-grant idempotent external submit/status/cancel; explicit scoped test exposure; provenance and bounded artifact segments with client whole-hash verification. Ordinary retry remains owner-only HTTP/UI; a new external attempt requires an explicit new submit and valid exact grant. Same-key acknowledgement reconciliation never creates a new attempt. Credential setup/revocation, human review and execution grants retain existing owner interfaces. Publish bounds and exclusions; reuse domain validation/errors without direct database or file-management tools. -**Acceptance gate:** Complete G5; equivalent agent/UI workflow yields equivalent domain evidence; revision conflicts, lost acknowledgements, revoked credentials and human-review spoofing are exercised through both public transports. No new actor-specific privilege bypass. +**Acceptance gate:** Complete G5 against the admitted matrix through a real workflow with separate owner review/grants. Compare domain evidence; exercise revisions, lost acknowledgements, revoked credentials, human-review spoofing, grant reuse, fresh external attempts, scoped test exposure and exact artifact reassembly. Excluded capabilities remain absent from MCP; existing HTTP authority is unchanged. No new actor-specific privilege bypass. **Status:** `Planned` +**Preparation admission:** [P6 exact contract and sequencing](reports/p6-admission.md). Source preparation is active; objective acceptance remains pending. + ### P7: Complete workflow and compatibility qualification **Goal:** Deliver an installable local workflow with preserved old data, explicit limitations and meaningful real scientific acceptance. diff --git a/docs/plans/generic-scientific-projects/reports/p6-admission.md b/docs/plans/generic-scientific-projects/reports/p6-admission.md new file mode 100644 index 00000000..8e3f0796 --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6-admission.md @@ -0,0 +1,443 @@ +# P6 admission: typed operations through existing HTTP owners + +Admitted for isolated source preparation on 2026-10-13 by the task integration +owner. Canonical plan: `docs/plans/generic-scientific-projects/plan.md`. +Worktree `/workspace/Tuldok-p6`, branch `feature/scoped-agent-operations-20261013`, +base PR52 source checkpoint `d191e681011756d7d3204604a410fe5619b5c559`. +Main was freshly fetched and remains `c522bf6b5eaf94d89811578c9e73aecfdba4ef9e`; +PR32/33 and PR38–52 remain unmerged drafts. No merge or deployment is admitted. + +P5c's original evaluation continues against frozen `/workspace/Tuldok-p5c`. +This sequencing amendment admits independent P6 source preparation only: no +edits to that worktree's runtime/UI/adapter sources, no package installation or +competing tests during its benchmark. Dependent actual P6 workflow qualification +waits for P5c actual gates and final regression/CI; any owning fixes propagate +before acceptance. Root preserves both worktrees and publishes separate drafts. +The active integration slice remains P5c qualification until those gates close. + +Current checkpoint: implementation and focused checks are recorded in +[p6-verification.md](p6-verification.md); final acceptance remains pending. +The initial source-only restriction below is retained as sequencing history; +focused tests began only after the P5c benchmark completed and drained. + +The named matrix below, including scoped `runs.expose_test`, is admitted. +The stateless segment contract explicitly does not verify whole-file hashes. +Use explicit underscore MCP tool names mapped one-to-one to dotted operation IDs. +Registry version and deterministic digest identify the transport contract only; +the bridge checks the authenticated server discovery before mutations. Domain +identity, validation, authorization and lifecycle retain their existing owners. + +Dependency selection: adopt optional official `mcp==1.30.0` low-level server +(Python >=3.10, MIT, supports protocol 2025-06-18) and `jsonschema==4.26.0` +Draft202012Validator. The independent review compared a local stdio +implementation: it would own version negotiation, request lifecycle, typed +protocol models and schema semantics indefinitely, with no independent corpus +already present here. The maintained SDK delegates those standardized semantics; +Tuldok still owns strict bounded framing, fixed loopback HTTP, scopes and errors. +Do not create a custom JSON Schema evaluator. Record the exact jsonschema pin, +resolution provenance and remaining SDK controls in the dependency review before +protocol implementation. App/discovery imports must remain usable without these +optional packages; no automatic installation or training-runtime mutation. + +Exact ownership: root owns app.py discovery/segment route, README, plan/reports +and public end-to-end qualification. Root also owns `.github/workflows/tests.yml` +for an explicit isolated optional-SDK gate; base app tests retain their original +dependencies. Registry/client owner owns agent_api.py, +its contract and focused tests; protocol owner owns mcp_stdio.py, optional pinned +requirements and protocol tests; Runs owner owns runs.py segment method and +focused artifact-segment tests. Canonical data owners remain unchanged unless a +concrete defect is separately admitted. Shared app/routes have one root owner. +All focused and full verification remains required, with no source-only +completion claim. No new scheduler, catalog, credential issuer or grant authority. + +## Boundary and protocol + +Add a tools-only local stdio MCP adapter pinned to protocol 2025-06-18. It is a +client of one explicitly configured existing loopback Tuldok HTTP server. It never +constructs Dataset, opens the catalog, imports a domain owner, starts a worker, +creates a scheduler, discovers hosts, or runs shell commands. Owner approval, +human review, credential issuance and revocation remain existing authenticated +HTTP/UI authority; documentation covers their explicit setup. Agent tools cannot +mint credentials, approve grants, or claim human review. A credential with execute +scope can use only the already admitted external-submit exception, consuming an +exact owner grant. Existing ordinary execute guards stay owner-only. + +Use one versioned operation registry in agent_api.py: operation name, exact JSON +input/output envelope schema, required scope, owner restriction, side effects, +approval/idempotency/revision behavior, fixed method/path/query/body projection, +and response kind. No arbitrary URL/method/headers/body forwarding tool. Publish +that same registry at authenticated GET /api/agent/operations, and project its +tool definitions into MCP tools/list. Existing HTTP route/domain validation stays +canonical. Registry schema checking covers transport shape and bounds; do not +reimplement scientific validation or silently accept arbitrary body objects. +Registry does not imply every legacy provider/network/admin endpoint is exposed. +Publish an explicit supported-operation matrix and list owner-only exclusions. + +Server capabilities exactly {tools:{}}; no resources/prompts/roots/sampling, +subscriptions, logging notifications, or tool-list change capability. Parse one +UTF-8 JSON-RPC object per newline, reject duplicate keys/nonfinite values/batches, +cap input line at 1MiB and JSON depth, and write only protocol responses to stdout. +Initialize before tools; await notifications/initialized. Support ping, tools/list +and tools/call; reject duplicate initialize and out-of-state requests. Ignore +unknown notifications without a response; reject unknown request methods. Offer +only 2025-06-18 when another version is requested (standard negotiation); client +must decide compatibility. EOF exits without cancelling durable Runs. Sequential +bounded calls are sufficient initially; document that cancellation of a durable +Run is its explicit run.cancel operation, not termination of this bridge. + +Official primary references verified 2026-10-13 (pinned version, not latest alias): +- https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle +- https://modelcontextprotocol.io/specification/2025-06-18/basic/transports +- https://modelcontextprotocol.io/specification/2025-06-18/server/tools + +## HTTP transport and credentials + +Configure fixed http://127.0.0.1:PORT or http://[::1]:PORT, no hostname/DNS, +userinfo, query, fragment, base-path or non-loopback address. Construct paths +from registry plus individually encoded validated segments. Use direct +http.client connections, no proxy environment or redirects; reject any3xx. +Use finite connect/read and absolute call deadlines, response length limits, +identity encoding only, and reject malformed/truncated HTTP framing. A private +configuration file may name the endpoint and expected catalog identity. Read +bearer credential from an explicitly supplied inherited private descriptor or +owner-only nofollow regular token file, bounded4KiB; never command-line token, +stdout/stderr token echo, generic environment dump or request-header logs. +Validate the identity against /api/access/session and catalog against workspace +context; require agent kind for the initial adapter to avoid accidentally giving +an agent session owner powers. Revocation is still rechecked by every HTTP call. +Neither startup inspection nor cached tool metadata grants later authorization. + +Existing app.py credential boundary is shared: GET requires inspect; +POST binds bearer and domain guards enforce scopes. Mixed cookie/bearer is403, +missing/malformed bearer401. Domain errors retain {error,code} and status; +commit_unknown/storage are503 and must never trigger automatic mutation retry. +A lost response to submit is resolved by explicit same request_key/body retry +against existing idempotency receipts, not a newly generated request key. + +## Admitted operation matrix + +Source inspected: /workspace/Tuldok-p5c/app.py GET/POST workspace and workbench +routes, projects.py, workbench.py, dataset_releases.py, pipeline.py, runs.py and +native asset owners. These are admitted operation names. Implementation and focused checks are now +recorded in the verification report; final qualification remains pending. +Prefix paths below with /api. IDs and fixed route segments are encoded separately. +Every row becomes named tools with closed schemas; no generic HTTP dispatch tool. +Scope column is the domain minimum in addition to inspect required for bootstrap. + +| Exact proposed operations | Existing method/path and canonical owner | Scope / bounded support | +| --- | --- | --- | +| context.get; identity.get | GET workspace/context; GET access/session | inspect; omit secrets, require same configured catalog and agent kind | +| projects.list; projects.get; projects.open | GET workspace/projects; GET workspace/projects/:id; POST workspace/projects | inspect/edit; open exactly {root,manifest_path}, root must already be owner-configured | +| projects.evidence | GET workspace/projects/:id/evidence/:ref | inspect; Projects.evidence bounded declared text/Markdown/JSON | +| recipes.list; recipes.inspect | GET workspace/definitions; GET workspace/projects/:id/recipes/:ref?expected_sha256= | inspect; Pipelines.definitions/inspect_external_recipe, no native probe or execution | +| data.query; data.get; data.history | GET workbench/records; records/:id; history/:id | inspect; Workbench.query/get/history; query offset>=0, limit1..100 and q/kind/review/sort/task/label/group/rights only | +| data.audio; data.mesh; data.pointcloud | GET workbench/audio-inspection/:id; mesh-inspection/:id; pointcloud-inspection/:id | inspect; respective immutable asset inspect owner | +| data.volume; data.scientific | GET workbench/volume-inspection/:id?axis=&index=; records/:id/scientific?frame=&field=&axis=&index= | inspect; bounded owner slice, no full array expansion | +| data.responses; data.preferences | GET workbench/records/:id/responses; records/:id/preferences | inspect; Workbench.responses/Preferences.list | +| data.import_image; data.import_text | POST workbench/import | edit; Workbench.import_asset; closed kind-specific union, image base64/text plus name/rights/groups/parents | +| data.import_audio; data.import_mesh; data.import_sequence; data.import_pointcloud; data.import_volume | POST workbench/audio-import; mesh-import; sequence-import; pointcloud-import; volume-import | edit; existing native parser owner; exact wav or files envelope with name/rights/groups/parents, no invented bundle shape | +| data.import_project_scientific; data.import_run_scientific | POST workspace/projects/:id/import-data/:ref; workspace/runs/:id/import-data/:artifact | edit+inspect; ScientificFields.admit/admit_run_artifact through Projects/Runs custody, expected_sha256 required, optional name/rights/groups/parents | +| data.save_draft | POST workbench/records/:id | edit; Workbench.save; exact revision/source_revision/task/annotation/groups and review constrained to draft, subtype-specific annotation schema | +| responses.save_draft | POST workbench/responses | edit; save_response existing id/prompt_id/revision/parent_revision/source_revision/completion/review envelope, review=draft | +| proposals.caption_list; proposals.caption_get; proposals.caption_decide | GET workbench/caption-proposals[/id]; POST workbench/caption-proposals/decide/:id | inspect/edit; completed owner-started proposals only, decision reject or apply_draft with exact revision | +| proposals.classification_list; proposals.classification_get; proposals.classification_decide | GET workbench/text-classification-proposals[/id]; POST workbench/text-classification-proposals/decide/:id | inspect/edit; reject or apply_draft; latter binds exact frozen labels and revision | +| releases.list; releases.inputs; releases.preview; releases.freeze | GET workspace/releases; GET workbench/releases/input-candidates; POST workbench/releases/preview; POST workbench/releases | inspect/freeze; initial advertised format canonical_v1 only, exact selected revisions/items/ratios/seed and required preview_token for freeze; same family/review validation | +| graphs.list; graphs.get; graphs.create; graphs.create_external; graphs.save; graphs.clone | GET workspace/graphs[/id]; POST workspace/graphs[/external]; POST workspace/graphs/:id[/clone] | inspect/edit; Pipelines methods; closed graph variants, CAS save revision+document, existing recipe/node limits | +| graphs.validate; graphs.preflight_external | POST workspace/graphs/:id/validate; /preflight-external | inspect; exact revision, existing owner; native preflight execute guard can deny agent, never bypass it | +| run_inputs.list | GET workspace/run-artifact-inputs | inspect; Runs.input_candidates, receipt-only status preserved, max100 completed candidates as existing owner | +| runs.list; runs.get; runs.progress; runs.predictions | GET workspace/runs[/id]; runs/:id/progress; runs/:id/predictions?split= | inspect; Runs existing owners, progress/summary is current bounded projection, held-out denial preserved | +| runs.submit_external | POST workspace/runs/submit-external | inspect+execute and exact existing actor/material owner grant; request_key/graph_id/graph_revision/expected_digest/approval_id ALL required by agent schema | +| runs.cancel | POST workspace/runs/:id/cancel {} | cancel; same Runs cancellation/drain state, no helper or process access | +| runs.expose_test | POST workspace/runs/:id/expose-test {reason} | expose-holdout; exact existing Runs.expose_test disclosure and audit, no owner-only or new grant requirement | +| runs.artifact_chunk | proposed POST workspace/runs/:id/artifact-segment/:name | inspect; NEW narrow Runs read owner described below; no arbitrary filename/path or bridge file write | + +Data query/get cover all eight kinds: image, text, audio, mesh, sequence, pointcloud, +volume, field_sequence. Image/text/sequence inspection is the actual record's +metadata/annotation and existing declared source metadata; there is no invented +sequence-frame HTTP view. Mesh/point/volume/audio/scientific typed views retain the +existing owner limits. This does not promise a full image/audio binary rendering +tool. All twelve existing TASKS must have exact draft annotation schemas before +claiming draft-edit parity: image_detection/image_classification/image_caption, +text_classification/text_entities/text_corpus, sequence_transport/mesh_geometry, +audio_timed/pointcloud_geometry/volume_grid/field_sequence_fields. No scientific +schema copies: registry describes request shapes, owners validate semantics. + +Initial stdio request cap stays1MiB. Inline imports are explicitly limited to +512KiB aggregate decoded original bytes (including all files) and total request +under1MiB; this is useful for bounded native fixtures, not parity for arbitrary +large uploads. Large scientific input uses existing manifest-declared Project or +completed Run references and server-side hash verification, with existing40MiB +per-input cap. No tool accepts local filesystem paths except the already-owned +project root alias/manifest relative reference. Refusal must name the supported +bound and route the user to existing HTTP/UI; never claim all HTTP upload sizes. + +Native file union must come directly from current parsers: mesh.ply+mesh.json; +points.ply+points.json; volume.npy+volume.json; sequence run.json+frames.jsonl forv1 and additionally controls.json forv2 +(the prepare_files closed variants), and +wav for audio. No multipart protocol or generic source-reading endpoint. Tests must cover both +sequence variants without weakening the native contract or exceeding inline caps. + +Explicit HTTP/UI-only exclusions: owner human review, preference approval, +execution-grant creation/revocation, credential administration/bootstrap, +provider discovery/configuration, proposal-start/native model execution, +ordinary runs.submit/retry, backup/restore/runtime snapshot maintenance, +procedural generation, native text/detection/caption bulk import workflows, +saved search/selection mutations and alternate export projections. Holdout +exposure is supported ONLY through its separately issued expose-holdout scope; +test predictions remain denied until the existing disclosure owner permits them. These exclusions must appear in the +published registry contract. No tools named approve/review pretending agent draft +application is human acceptance. Owner review and exact grant setup are exercised +through authenticated UI/HTTP in QA, never delegated through MCP. + +Project evidence has the existing GET /api/workspace/projects/:id/evidence/:ref +route, owned by Projects.evidence. The admitted projects.evidence operation +exposes that bounded declared text/Markdown/JSON read; no arbitrary file read is added. Release ZIP downloads and record-source binary +HTTP endpoints remain existing HTTP-only initially; P6 artifact-byte acceptance +is explicitly completed external Run artifacts, not every binary endpoint. + +## Artifact decision: owner segments with client whole-file verification + +CHOSEN proposal: add one bounded, authenticated, stateless Runs.artifact_segment +owner and matching HTTP operation. Preserve existing full download route and +Runs.open_artifact verified anonymous spool completely unchanged. Do not implement +a bridge cache, managed download file, opaque path token, second artifact store, +or Library integration. No arbitrary output path is accepted or returned. + +Request exactly {expected_sha256,offset,max_bytes}; name/run_id are path params. +Require SHA256 lowercase64hex, offset integer0..artifactbytes, max_bytes1..8MiB. +Initial support only completed external recipes and declared payload names. +Whole artifact cap is the admitted output rule (currently512MiB for large, +64MiB for old); aggregate Run output may be4GiB. No generic Range interpretation. +This is a JSON operation, not a falsely advertised HTTP206 implementation. + +The Runs owner checks catalog access, completed record/material/spec, approved +output declaration, retained manifest/custody and current exact inventory using +existing _external_inventory. Bind expected_sha256 to the authoritative declared +whole SHA. Open selected file nofollow, require currentuid/regular/nlink1/exact +size, pread only requested bounded region, compare fstat before/after plus named +inode identity. Return bytes encoded once by HTTP or bridge; choose one encoding +layer in implementation. Closed response: +{run_id,name,expected_sha256,total_bytes,media_type,offset,bytes,next_offset,eof, + segment_sha256,data_base64,verification:"segment_read_whole_hash_unverified"}. +Segment SHA hashes the returned bytes only. No claim that a range read proves the +whole payload still matches the retained receipt. A same-size changed segment +can be returned with its actual segment hash; final whole-file client hashing +MUST fail against expected_sha256. This limitation is deliberate and visible. + +Client reassembles in exact offsets with stable identity/total, verifies each +segment hash, then verifies final whole SHA before treating the artifact as +verified or usable as checkpoint/evidence. Provide a bounded test client example +that streams hashes; it need not write a file. MCP host itself does not silently +assemble/download arbitrary paths. If downstream clients cannot honor this +contract they must use the existing full verified HTTP download instead. Tests +must demonstrate mutation/revocation between chunks cannot yield final accepted +whole content. Empty file and offset==EOF yield zero bytes/eof with emptysegment +SHA. Reject offset>EOF, malformed ints/bools, growth/truncation, nonregular paths. + +Complexity is linear total payload reads plus O(chunks*smallinventory), with no +O(chunks*payload) whole-file hash.8MiB keeps a200MiB artifact to25 calls; base64 is +~11.2MB per maximum response. Set explicit16MiB HTTP JSON envelope cap and32MiB +MCP response cap because compatibility text serialization duplicates the same +structuredContent object, including base64. Both are finite and distinct from +1MiB request cap. Exact deadline and response limits must be published; no silent +truncation. Existing tools returning HTTP JSON exceeding16MiB fail explicitly; +they are not claimed unbounded parity. Avoid accidental unbounded third copies. + +Rejected alternatives: fetching the existing full verified spool per8MiB chunk +would read/hash200MiB25times (~5GiB), plus server spool writes;1MiB would cost +~40GiB. A bridge-owned temporary file amortizes this but adds lifecycle/credential +revocation/cache custody and disk ownership absent from current plan. A single +full artifact base64 tool exceeds honest bounded response limits. New stateless +segments are the smallest explicit tradeoff while the full verified HTTP route +remains available. + +## Errors and tests + +JSON-RPC parse/envelope/method/schema failures use protocol errors. Valid tool +calls rejected by HTTP return isError:true and structuredContent with original +HTTP status/code/error; include equivalent text content for client compatibility. +Successful structuredContent uses a stable object envelope {status,result} even +if HTTP result is a list. Do not put raw server HTML, credentials or Python +tracebacks in errors; bound message sizes. No automatic replay of mutations. + +Tests required before G5 complete: +1. Real subprocess stdio lifecycle, negotiation, ping, list schema, call; malformed, + duplicate/nonfinite/deep/oversized JSON, unknown methods/tools, notifications, + EOF, stdout cleanliness and no secrets in errors/logs. +2. Real authenticated loopback HTTP plus same domain catalog: every registry + operation schema has a tested route projection; tool list equals HTTP discovery. + End-to-end project/data/draft-review-by-owner/freeze/graph/preflight/owner grant/ + agent submit/status/artifact/import workflow; compare domain digests/evidence, + not actor-specific IDs/timestamps. No second scheduler or Dataset in adapter. +3. Different agent scopes, revoked/expired/wrong-catalog credentials; forged human + review/owner identity; approval wrong actor/material/stale revision/reuse; stale + graph save; owner-only setup excluded. Assert no DB write or native spawn. +4. Lost acknowledgement/commit_unknown: same-key replay returns same durable Run; + different body same key conflicts; unknown custody stays fenced. Durable Run + survives MCP disconnect. Explicit cancellation uses sole Runs owner. +5. Artifact binary/empty/multichunk exact reassembly including >8MiB authored payload, + incorrect expected digest, mutated/truncated content, final whole-SHA rejection, + response overflow, chunk bounds, denied/nonexternal routes, revoked credential + between chunks, no HTTP Range assumption. Count actual bytes read to prove + linear payload reads; old full verified downloads and old-profile guards unchanged. +6. Mock hostile transport redirection/proxy env/non-loopback URL/header injection, + response-size/deadline/framing failures, source config mode/symlink rejection. + +Proposed write set after admission: agent_api.py (registry + bounded HTTP client), +mcp_stdio.py (stdio protocol only), docs/contracts/agent-operations.md, versioned +schema artifact if not generated directly, tests/test_agent_api.py, +tests/test_mcp_stdio.py, app.py authenticated discovery and fixed segment route, runs.py narrow segment owner +with tests/test_artifact_segments.py, README local setup, +P6 plan/report. Existing owner fixes only if tests reveal a concrete parity gap; +no new database tables, runtime profile changes, executor, package installation, +or network/provider discovery. The admitted supported-operation matrix bounds this implementation; one +scientific checkpoint does not establish all legacy surface parity. + +## Protocol conformance details and admission gaps + +Official lifecycle confirms initialize is first, version negotiation precedes +initialized, and transport close ends stdio without a special shutdown method. +The fixed-version server responds2025-06-18 to a different requested version; +that is negotiation, not pretending it implements the client's requested one. +Official tools require tools capability, schemas and distinct protocol/tool +execution errors; structuredContent must satisfy declared outputSchema and +serialized text is recommended for compatibility. Stdio uses UTF-8 newline +framing with protocol-only stdout. The HTTP hop here is ordinary existing Tuldok +HTTP, NOT MCP StreamableHTTP; do not claim MCP HTTP/session/SSE conformance. + +Tool listing is a small fixed inventory: return all supported definitions with no +nextCursor; reject nonempty unknown cursor. Tool schemas use additionalProperties +false recursively for transport-owned closed envelopes. JSON-RPC IDs permit +integer/string IDs according to pinned base spec, never bool; preserve exactID. +Protocol notifications receive no response; unknown method requests do. A tool +annotation cannot authorize a scope; HTTP domain checks remain live authority. + +Root admitted this named matrix and segment semantics above. The detailed +dependency review fixes SDK/schema choices before their implementation. Remaining exact schemas (graph variants, annotation variants and +canonical release selections) are mechanical source-derived work, not authority +decisions. Registry-to-owner parity tests must cover each advertised subtype, +plus real agent workflow with separate owner UI review/grant. Initial bridge has +no model dependency, catalog migration, scheduler or snapshot changes. Optional +agent packages were subsequently installed only in the isolated P6 QA environment +as recorded in the dependency report. This admission itself changed no runtime +code or real evaluation; current implementation evidence is in p6-verification.md. + +## Admitted canonical-plan amendment record (2026-10-13 follow-up) + +The integration owner applied this amendment in the canonical plan. Original replacement wording follows for decision traceability. Replace the G5 requirement cell with: + +> Agent and UI clients reach the same domain owners for the admitted operation +> matrix and receive equivalent domain evidence when exercising equivalent +> authority. Owner-only setup/review/grant actions remain separate. Explicitly +> excluded HTTP capabilities are recorded, not counted as MCP parity. Stale +> requests, forged human review, unauthorized execution, path escape and approval +> reuse fail before side effects. + +Replace the P6 Goal with: + +> An agent discovers and controls the qualified workflow through the admitted +> typed operation matrix, with the same domain outcomes as equivalent authorized +> HTTP/UI actions. Capability parity means shared semantics and authorization +> within that matrix, not delegation of every UI privilege or legacy endpoint. + +Replace the P6 Tasks with: + +> Publish the versioned supported-operation and exclusion matrix; project/data/ +> recipe discovery; bounded queries and typed draft mutations; canonical release +> preview/freeze; graph editing/preflight; exact-grant idempotent external submit, +> status/progress and scoped cancellation; bound provenance and artifact segments. +> Document owner credential setup/revocation, review and exact execution grants +> through existing HTTP/UI. Include explicit test exposure through the existing +> expose-holdout scope and exact reason contract. Ordinary retry remains existing +> owner-only HTTP/UI. A transport reconnect or submit +> receipt reconciliation never creates a new attempt or approval. Tool schemas +> identify bounds, side effects and required authority. Reuse shared validation +> and errors; no direct DB or file-management convenience operations. + +Replace the P6 Acceptance gate with: + +> Complete G5 against the admitted matrix: equivalent authorized agent and UI +> actions produce equivalent domain evidence, and a real workflow crosses owner +> review/grant checkpoints without assigning owner identity to the agent. +> Exercise revisions, lost acknowledgements, revocation, human-review spoofing, +> approval reuse and exact artifact reassembly through public transports. +> Prove excluded capabilities remain absent from MCP; verify ordinary retry +> remains owner-only and test exposure preserves its explicit scope, irreversible +> audit and exact request semantics through both transports. No new actor-specific +> bypass. + +At the public-interface architecture paragraph (current plan.md:106), append: + +> This is the domain capability inventory, not a promise that every capability +> is delegated to the initial agent transport. P6's admitted matrix declares its +> supported bounded subset and exclusions. Existing HTTP operations retain their +> own scopes and owner restrictions; MCP omissions do not silently revoke them. + +Source distinction requiring accuracy: runs.py:1011 ordinary retry has +execute+owner_only. runs.py:1621 expose_test requires expose-holdout with NO +owner_only restriction; access.py:18 permits that scope on agent credentials. +Preserve both policies. External retry means a user-requested new external submit +with a new request_key and an exact valid owner grant; the bridge has no hidden +retry/fresh-grant policy. Replaying the SAME admitted request_key/body is only +receipt reconciliation, never a new attempt. + +### Exact runs.expose_test transport contract + +MCP arguments closed object {run_id,reason}, both required; run_id lowercase +32hex; reason string1..500 characters, trimmed nonempty, no surrogate codepoints. +Route POST /api/workspace/runs/:run_id/expose-test; body exactly {reason}. Canonical +owner remains Runs.expose_test with @authorized('expose-holdout',...). No new +preview token, execution approval_id, revision or request_key is accepted: the +existing route has none. Do not add owner_only or synthetic approval semantics. + +Existing owner loads the Run, refuses external recipes and integrity-validation +Runs, fully verifies its completed published artifacts, then transactionally +records each test source exposure plus the actor audit and Run exposure event. +Response contains id/run_id/release_id/created_at/reason and + test_exposure:{exposed:true,event_count}. Tool description says it irreversibly +records disclosure of held-out test results and requires explicitly issued +expose-holdout scope. readOnlyHint=false, idempotentHint=false; annotate the +irreversible side effect. Calling again can create another audit/event, so NO +automatic retries after a lost acknowledgement; inspect runs.get exposure state +and audit evidence first. Semantic prediction permission remains owned by Runs. + +Required tests: no scope ->403/no exposure mutation; eligible completed classifier +with scope -> persisted same domain exposure and subsequent test read; exact +reason and closed fields; external/validation/noncompleted refusal; artifact +tamper refusal; revoked credential; lost response causes no bridge replay. Owner +review/grant tools stay excluded. This restores the original accepted exposure +capability without broadening the service's authorization. + +## Pinned tool names and output-size evidence + +Pinned official schema inspected at: +https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/2025-06-18/schema/2025-06-18/schema.ts +Tool extends BaseMetadata (lines763ff); BaseMetadata.name is string (line260), +without a regular-expression restriction. The pinned tools specification also +requires unique names, not a no-dot rule. Therefore dotted registry names are +compatible with this pinned schema. This is not a guarantee every downstream +model tool wrapper permits dots. Minimal portability choice: freeze registry +operation_id as the dotted name and mcp_name as an explicit collision-free +underscore name, e.g. runs.artifact_chunk -> runs_artifact_chunk, under local +[a-z][a-z0-9_]{0,63}. Do not dynamically sanitize caller strings; freeze and test +the one-to-one mapping. Alternatively retain dots and name the clients tested. + +Current HTTP output has NO global16MiB limit: app.py:427 reply JSON-serializes +then reports its actual byte length. MAX_BODY40MiB is a request limit, not a +response limit. Runs.list/Projects.list/graph lists can grow with catalog size; +ordinary get/run documents can include substantial captured runtime metadata. +Workbench.query bounds page count1..100 but query analysis is catalog-dependent. +Typed source-owner limits constrain inputs/slices, not all serialized response +lengths. P6's proposed16MiB HTTP receive limit is an explicit client capability +bound; reject oversized responses before allocating/reading them, never claim +it is inherited from HTTP. List parity is qualified only for responses inside +that bound; paging must be an separately admitted owner change if later needed. + +An8MiB raw segment is8,388,608 bytes and canonical base64 is11,184,812 characters. +Base64 alone duplicated in structuredContent and compatibility text is22,369,624 +characters plus small metadata/JSON escaping.16MiB HTTP and32MiB MCP caps admit +this closed segment response. Arbitrary16MiB JSON can expand beyond32MiB when +serialized again as compatibility text; validate the final encoded MCP response +size too, returning an explicit response_too_large tool error. Do not assert all +16MiB HTTP JSON automatically fits32MiB MCP. A small fixed metadata bound makes +the segment guarantee measurable; include exact maximum envelope test. diff --git a/docs/plans/generic-scientific-projects/reports/p6-agent-dependencies.json b/docs/plans/generic-scientific-projects/reports/p6-agent-dependencies.json new file mode 100644 index 00000000..6c183764 --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6-agent-dependencies.json @@ -0,0 +1,348 @@ +{ + "date": "2026-10-13", + "pip_version": "25.0.1", + "environment": { + "implementation_name": "cpython", + "implementation_version": "3.12.14", + "os_name": "posix", + "platform_machine": "x86_64", + "platform_release": "6.18.44", + "platform_system": "Linux", + "platform_version": "#1 SMP Sat Sep 26 20:02:31 UTC 2026", + "python_full_version": "3.12.14", + "platform_python_implementation": "CPython", + "python_version": "3.12", + "sys_platform": "linux" + }, + "command": "python -m pip install --dry-run --ignore-installed --only-binary=:all: --report /tmp/tuldok-p6-agent-resolution.json -r requirements-agent.txt", + "index": "https://pypi.org/simple", + "advisory_source": "Version-specific PyPI JSON vulnerabilities (OSV-derived), plus official MCP/jsonschema repository advisory feeds", + "packages": [ + { + "name": "mcp", + "version": "1.30.0", + "wheel_url": "https://files.pythonhosted.org/packages/f5/f4/e58bc33317c92a0203664daaf00bf6f41166cc0149e5d6870a03f7cd004a/mcp-1.30.0-py3-none-any.whl", + "sha256": "666edb5009503e1047c9d60346a756f94b261f05cc2625f23d41c728ffc484d0", + "license": "MIT", + "license_classifiers": [ + "License :: OSI Approved :: MIT License" + ], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "jsonschema", + "version": "4.26.0", + "wheel_url": "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", + "sha256": "d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "anyio", + "version": "4.15.1", + "wheel_url": "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", + "sha256": "6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "attrs", + "version": "26.1.0", + "wheel_url": "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", + "sha256": "c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "httpx", + "version": "0.28.1", + "wheel_url": "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", + "sha256": "d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", + "license": "BSD-3-Clause", + "license_classifiers": [ + "License :: OSI Approved :: BSD License" + ], + "requires_python": ">=3.8", + "vulnerabilities": [] + }, + { + "name": "httpcore", + "version": "1.0.9", + "wheel_url": "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", + "sha256": "2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", + "license": "BSD-3-Clause", + "license_classifiers": [ + "License :: OSI Approved :: BSD License" + ], + "requires_python": ">=3.8", + "vulnerabilities": [] + }, + { + "name": "httpx-sse", + "version": "0.4.3", + "wheel_url": "https://files.pythonhosted.org/packages/d2/fd/6668e5aec43ab844de6fc74927e155a3b37bf40d7c3790e49fc0406b6578/httpx_sse-0.4.3-py3-none-any.whl", + "sha256": "0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "jsonschema-specifications", + "version": "2025.9.1", + "wheel_url": "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", + "sha256": "98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "pydantic", + "version": "2.14.1", + "wheel_url": "https://files.pythonhosted.org/packages/35/ea/a56b9fe5066f3537b7882f77e9c5dfb26d8c2eefdaed9b5fc73d57b4dc22/pydantic-2.14.1-py3-none-any.whl", + "sha256": "9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "pydantic_core", + "version": "2.50.1", + "wheel_url": "https://files.pythonhosted.org/packages/90/24/48cd98388e4ac2c08d0800af36d15413db15e20387f1038123a2c86cb2f6/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", + "sha256": "93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "pydantic-settings", + "version": "2.15.0", + "wheel_url": "https://files.pythonhosted.org/packages/30/a4/2bffa9f8e804325a09867f0e9d30795c80ea9f8d62560bd1b6ad6220eb2f/pydantic_settings-2.15.0-py3-none-any.whl", + "sha256": "0ba092c291c94baceb5eff768aa0d56400a457585bc0175925a5a5510303da42", + "license": "MIT", + "license_classifiers": [ + "License :: OSI Approved :: MIT License" + ], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "PyJWT", + "version": "2.15.1", + "wheel_url": "https://files.pythonhosted.org/packages/50/ca/44de4e75f8aadc457f0634be3b542815078ded46dca30efb960edeecad6e/pyjwt-2.15.1-py3-none-any.whl", + "sha256": "42d59d631f7768a1028a64c7ff581a9bf7519804daf91fc5b6c56e30eec5e193", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "python-multipart", + "version": "0.0.32", + "wheel_url": "https://files.pythonhosted.org/packages/e1/04/e8135ebd1ad02c56ec633277529b2602ff99ff634be76cdba5744cf554fd/python_multipart-0.0.32-py3-none-any.whl", + "sha256": "ff6d3f776f16878c894e52e107296ffc890e913c611b1a4ec6c44e2821fe2e23", + "license": "Apache-2.0", + "license_classifiers": [ + "License :: OSI Approved :: Apache Software License" + ], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "referencing", + "version": "0.37.0", + "wheel_url": "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", + "sha256": "381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "rpds-py", + "version": "2026.9.1", + "wheel_url": "https://files.pythonhosted.org/packages/1d/6d/b26eb1e75395925b3a142ed351cbed2ec8212f5c9d937aee3df32c701baa/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", + "sha256": "addeda51556dac7c1a2f14cda62db8b621cd12afba3091d03a96c72932387eab", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.11", + "vulnerabilities": [] + }, + { + "name": "sse-starlette", + "version": "3.5.0", + "wheel_url": "https://files.pythonhosted.org/packages/be/e4/cdda14023c316d71493bc54fdffc3dd006631b88866145c9d3cc33e0f1df/sse_starlette-3.5.0-py3-none-any.whl", + "sha256": "3e6e1070df3f0f5d9cea81496de92dbb72f6721871d99748ece67441dd8b7997", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "starlette", + "version": "1.8.0", + "wheel_url": "https://files.pythonhosted.org/packages/c1/b0/5742e4ac7af5eb58ec3470a537a49d7aa507e5539413e504b3a65ef50ba8/starlette-1.8.0-py3-none-any.whl", + "sha256": "dfdd6b29c26483288088d990eee59631dedadd66ce20d203402a7ca8e3c4656f", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.11", + "vulnerabilities": [] + }, + { + "name": "typing_extensions", + "version": "4.16.0", + "wheel_url": "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", + "sha256": "481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", + "license": "PSF-2.0", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "typing-inspection", + "version": "0.4.4", + "wheel_url": "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", + "sha256": "65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", + "license": "MIT", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "uvicorn", + "version": "0.54.0", + "wheel_url": "https://files.pythonhosted.org/packages/38/0c/b54a4fdd7f90a3af8b02ebc9ce6712c2c208b7926a2f7bad95c33ebbe943/uvicorn-0.54.0-py3-none-any.whl", + "sha256": "505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "annotated-types", + "version": "0.8.0", + "wheel_url": "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", + "sha256": "f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", + "license": "MIT", + "license_classifiers": [ + "License :: OSI Approved :: MIT License" + ], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "click", + "version": "8.5.0", + "wheel_url": "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", + "sha256": "255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "cryptography", + "version": "50.0.2", + "wheel_url": "https://files.pythonhosted.org/packages/d3/69/2c833a049475e0a3444e94c7d0aca0aa51d166374a449b09e92ac98138de/cryptography-50.0.2-cp311-abi3-manylinux_2_34_x86_64.whl", + "sha256": "9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079", + "license": "Apache-2.0 OR BSD-3-Clause", + "license_classifiers": [], + "requires_python": "!=3.9.0,!=3.9.1,>=3.9", + "vulnerabilities": [] + }, + { + "name": "h11", + "version": "0.16.0", + "wheel_url": "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", + "sha256": "63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", + "license": "MIT", + "license_classifiers": [ + "License :: OSI Approved :: MIT License" + ], + "requires_python": ">=3.8", + "vulnerabilities": [] + }, + { + "name": "idna", + "version": "3.20", + "wheel_url": "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", + "sha256": "ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.9", + "vulnerabilities": [] + }, + { + "name": "python-dotenv", + "version": "1.2.4", + "wheel_url": "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", + "sha256": "42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "certifi", + "version": "2026.7.22", + "wheel_url": "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", + "sha256": "62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", + "license": "MPL-2.0", + "license_classifiers": [ + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)" + ], + "requires_python": ">=3.7", + "vulnerabilities": [] + }, + { + "name": "cffi", + "version": "2.1.1", + "wheel_url": "https://files.pythonhosted.org/packages/b1/db/dceb9dd5b231e1da801793f8acc9f3c52a7e1afe40bb1aae37e02b0faad5/cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", + "sha256": "c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf", + "license": "MIT-0", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + }, + { + "name": "pycparser", + "version": "3.11", + "wheel_url": "https://files.pythonhosted.org/packages/90/11/0e6f11117525ff0eec40ebac3d313376f102df93ca44ad9e893ee85e4f89/pycparser-3.11-py3-none-any.whl", + "sha256": "51d5a8ba2be0bbe440b99d2112604c95bbbc3c2748a64260186c541e1729cd80", + "license": "BSD-3-Clause", + "license_classifiers": [], + "requires_python": ">=3.10", + "vulnerabilities": [] + } + ], + "installation": { + "interpreter": "3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]", + "platform": "Linux-6.18.44-x86_64-with-glibc2.41", + "lock_sha256": "bfe34b7377e3a2527eec8635b4cf28ce1d74a555f0d192d7585d76f8f5124380", + "command": "python -m pip install --require-hashes --only-binary=:all: -r requirements-agent.lock", + "installed_versions_match": true, + "pip_check": "No broken requirements found.", + "base_fixture_dependencies": { + "Pillow": "12.3.0", + "psycopg": "3.3.6", + "psycopg-binary": "3.3.6" + } + }, + "consumer_tests": { + "command": "python -m unittest discover -s tests -p test_mcp_stdio.py -v", + "passed": 12, + "skipped": 0, + "seconds": 9.897, + "scope": "Actual official SDK clients/processes; authored HTTP backend, not public workflow acceptance" + } +} diff --git a/docs/plans/generic-scientific-projects/reports/p6-dependency-review.md b/docs/plans/generic-scientific-projects/reports/p6-dependency-review.md new file mode 100644 index 00000000..c52d660e --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6-dependency-review.md @@ -0,0 +1,294 @@ +# P6 dependency and protocol boundary decision + +2026-10-13; dependency decision followed by admitted isolated source preparation. +No packages installed, model executed or active P5c source changed. +Source preparation is confined to the separately admitted P6 worktree; real workflow qualification still +waits for P5c gates. This records the implementation-versus-adoption decision +required by adopted Coding-Standards/topics/dependencies.md. + +## Requirement and selected candidate + +Consumer: optional local agent bridge, not app server, catalog readers, native +recipes or captured scientific runtime. Required surface: MCP stdio tools over +one existing authenticated loopback HTTP server; bounded framing/transport; +2025-06-18 tool/lifecycle interoperability; published JSON Schema input/output +contracts; existing owner permissions and durable idempotency unchanged. + +Select the official Python MCP SDK **mcp==1.30.0**, using its low-level server and +types, with **jsonschema==4.26.0**, using Draft202012Validator. These are concrete +candidate pins accepted for implementation dependency declaration, not a claim +of installed or security-qualified artifacts. Full resolver/hash closure and +consumer tests must succeed before calling the optional bridge available. + +Official source facts: +- MCP1.30.0 requires Python>=3.10, MIT license, and its supported-version list + explicitly includes2025-06-18. The SDK provides typed messages, server/session, + request/result handling, schema integration and official client interoperability. +- jsonschema4.26.0 requires Python>=3.10, MIT license. Its declared dependencies are + attrs, jsonschema-specifications, referencing and rpds-py. Use explicit2020-12 + dialect, not whichever draft a future default picks. Format extras are unused. +- MCP pulls a broader closure including anyio, httpx/httpx-sse, pydantic/settings, + starlette, multipart/SSE, uvicorn and pyjwt/crypto. We do not enable its HTTP/SSE, + OAuth, tasks, sampling or network server APIs. Unused imported dependency surface + still belongs in resolution/vulnerability review; transitive count alone is not + a reason to replace standardized semantics locally. +- Current base app interpreter has none of mcp,jsonschema,pydantic,anyio installed. + The proposed dependency is genuinely optional, not ambient availability. + +Primary source links (inspected read-only): +- https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/v1.30.0/pyproject.toml +- https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/v1.30.0/src/mcp/shared/version.py +- https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/v1.30.0/src/mcp/server/session.py +- https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/v1.30.0/src/mcp/server/stdio.py +- https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/v1.30.0/src/mcp/server/lowlevel/server.py +- https://raw.githubusercontent.com/python-jsonschema/jsonschema/v4.26.0/pyproject.toml +- https://python-jsonschema.readthedocs.io/en/stable/validate/ +- https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle +- https://modelcontextprotocol.io/specification/2025-06-18/server/tools + +## Comparison against local protocol/schema implementation + +| Requirement | Official SDK + jsonschema | Local MCP subset + custom schema verifier | +| --- | --- | --- | +| Message types/structured results | Existing versioned implementations, official clients/tests | Project maintains unions, IDs, errors and extension behavior | +| Initialization/notifications | SDK behavior inspectable and interoperability-testable; narrow profile adapter still needed | Entire state machine and version-negotiation compatibility owned locally | +| Schema semantics | Established draft validator, schema self-checking, reference handling | oneOf/required/additionalProperties/numeric/string semantics and future drift become local obligations | +| Tuldok-specific limits/auth | Still local: strict JSON/framing, no redirects, credentials, HTTP deadlines, registry parity | Same local obligations; removing SDK does not remove these | +| Packaging/security | Optional dependency lock, upstream advisories, update testing, no app import cost | No package closure, but local protocol bugs/security updates have no upstream implementation fix | +| Maintenance and claim scope | SDK pin + narrow bounded adaptation tests; no general protocol reimplementation | Continuing independent conformance work for every claimed behavior/draft keyword | + +Choose SDK/schema implementation because they own difficult standard semantics, +not because of popularity or line counts. The remaining local framing/profile +adapter is explicit and reviewed. Reconsider selection if adaptation would need +SDK private session monkeypatches or copying its main request dispatcher. Do not +silently fall back to a local protocol engine when a package or API is blocked. + +## Exact optional declaration and environment proposal + +Create optional `requirements-agent.txt` with these direct constraints: + +``` +mcp==1.30.0 +jsonschema==4.26.0 +``` + +Keep it outside base requirements and scientific training/runtime declarations. +If repository convention supports generated lock files, use +`requirements-agent.lock` for the full resolver-produced transitive versions and +SHA256 hashes, recording exact interpreter/platform/resolver command and source +index. Do not invent transitive pins from guessed current releases. The input +file owns the two direct requirements; the lock is generated resolution evidence, +not another manually maintained authority. Installation uses that lock with +`--require-hashes`, after explicit resolution/provisioning admission. If source +preparation precedes resolution, describe dependency satisfaction as pending. + +Use a task-owned isolated QA virtualenv in the P6 worktree or explicit scratch +path, from the existing supported host Python. No modification of the base app +venv, trainingvenv, captured runtime snapshot or global site packages. No startup +pip calls, auto-install fallbacks or shell/provider discovery from bridge code. +A missing optional dependency produces a concise setup error without token or +traceback exposure. Separate pure app/registry tests must pass with imports of +mcp/jsonschema/pydantic/anyio blocked. Optional SDK tests require the explicit QA +interpreter and fail setup clearly; they must not count skipped tests as P6 proof. + +Before install: resolve all package versions/hashes, inspect source provenance, +licenses, available wheel/platform compatibility and relevant advisories. Record +why accepted. Updates are explicit pin/lock changes owned by P6 maintainer and +must rerun real SDK client lifecycle, schema corpus and HTTP parity/denial tests. +Removal is possible by deleting optional bridge/declaration only; app API keeps +its independent owner behavior and stdlib discovery. + +## Import ownership and schema authority + +`agent_api.py` registry and authenticated app discovery MUST remain stdlib-only at +import. It contains versioned bounded transport declarations, path projections +and metadata; it must not import optional SDK/schema packages or instantiate +Dataset/domain owners. Registry scope annotations are descriptive, not new auth. +The existing server continues canonical body/scientific/revision/access checks. + +Bridge/client validation lazily imports jsonschema in its optional boundary. +Publish `$schema: https://json-schema.org/draft/2020-12/schema` on each schema; +instantiate/check Draft202012Validator for all input/output schemas at bridge +startup. Use self-contained schemas or explicitly supplied in-memory $defs; +reject external $ref/$dynamicRef URIs at registry lint time and configure a +retrieval callback that always refuses network/filesystem resolution. No format +extras: express bounded identifiers with type/pattern/length, not assumed format +validation. Unknown schema dialect/keyword dependence is an admission failure, +not an ignored custom-validator branch. Meta-schema checking is not enough: +positive/negative request fixtures must demonstrate each used construct. + +Avoid a second registry of domain semantic constraints. Source-derived transport +shapes describe fields/representation; parity tests call actual owner routes for +all advertised12 task annotations and native import variants. If a shared owner +constant can be projected without dragging server imports into the bridge, +extract a small pure contract constant only with owner approval. Do not broadly +refactor validators to suit MCP. Registry version plus canonicalSHA are published +by HTTP; bridge startup compares expected local version/hash after identity and +catalog checks and refuses mismatch before any mutation. Never negotiate a +silently reduced mutation surface on mismatch. + +## Pinned protocol and bounded SDK adaptation + +SDK1.30.0 supports more versions than this product initially advertises. Its +ServerSession responds with a requested supported version, else SDK latest; there +is no public per-Server supported-version constructor in the inspected path. +Do NOT patch SDK globals or its private session method. Use the low-level Server +with standard public memory streams and an explicit transport profile adapter. + +At the bounded input stream edge, retain the original requested version for +negotiation diagnostics, normalize ONLY initialize.params.protocolVersion to the +single supported2025-06-18 value passed to SDK. The SDK therefore returns2025-06-18 +using its normal initialization response. This is the product's explicit narrow +version-selection policy, not a claim it supports the client's rejected version. +The client's initialized notification accepts the offered version; an incompatible +client must close. Do not rewrite other capabilities/arguments/IDs. Test requested +2025-06-18, an SDK-supported older version, and unknown/newer version, all yielding +the truthful single offered version. This small adaptation must be recorded and +reviewed; if public-stream integration cannot implement it without duplicating +SDK session internals, stop and revise the version policy rather than monkeypatch. + +SDK default stdio iteration is not the1MiB/depth/duplicate-key/nonfinite boundary. +Implement a bounded strict UTF-8 JSON line transport before constructing SDK +JSONRPCMessage/SessionMessage. It handles maximum bytes/depth/IDs/duplicate keys, +uses bounded memory streams, and emits only complete final capped JSON lines. +Keep transport-level profile states to refuse duplicate initialize, require +notifications/initialized before tools, and handle unknown notifications without +forwarding them into an SDK error/log notification. This is necessary because the +inspected SDK marks initialized after its response, before the client's notice. +Do not register resources/prompts/tasks/logging/progress/sampling handlers or +capabilities; tools and ping are the advertised surface. Unsupported request +methods receive bounded standard protocol errors at this profile boundary. + +Tool schemas/dispatch remain the single registry. The SDK call_tool decorator +normally validates schemas and can turn exceptions into text. Prefer explicit +bridge validation with the pinned validator (and SDK validate_input=False) so +error mapping/redaction and reference refusal are controlled consistently. Return +explicit typed CallToolResult only after output-envelope schema validation; +avoid accidental duplicate normalization or raw exception messages. SDK handles +normal message/result serialization and lifecycle; final transport writer checks +encoded total size, including structured+compatibility text duplication. + +This adaptation still has conformance/maintenance cost. Required tests include a +real official SDK client plus raw hostile-framing tests, with no supported +capability beyond tools advertised. Do not claim MCP StreamableHTTP support: the +internal existing Tuldok HTTP hop is not an MCP transport. + +## HTTP deadlines, serialization and retries + +Proposed explicit initial limits: connection timeout5s, per-block socket timeout +min(5s, remaining), absolute complete-call deadline120s, response body16MiB, +request1MiB, final serialized MCP message32MiB. HTTP preflight can scan scientific +inputs/runtime, so5s total would falsely promise availability;120s is a bounded +initial policy needing actual representative preflight measurement. A timeout +fails explicitly and does not cause mutation replay. If measured qualification +needs another value, record that change before release rather than silently +extending time while waiting. Enforce absolute time during header/body reads; +per-read timeouts alone do not stop trickle responses. Reject conflicting length/ +transfer encodings, unexpected compression, redirects, truncated body or trailing +framing inconsistency. Read at most cap+1 and never truncate a successful result. + +Fixed numeric-loopback endpoint only, direct http.client with no proxy env, +no URL redirection, and validated separately encoded path segments. Credentials +come from explicit private descriptor or bounded owner-only nofollow file. +Startup checks agent kind, configured catalog and registry version/hash. Every +HTTP call still goes through current Access, so revocation remains immediate for +subsequent requests. No credential value, headers or raw exception dump in logs. + +One in-flight HTTP tool call; no background mutation queue. Use SDK async +integration with backpressure and finite streams, not blocking the event loop +with an unbounded task backlog. Reject overlapping calls with a bounded busy +result or explicitly serialize admission with no accumulation. Choose/document +one behavior in implementation tests. There is no new arbitrary requests/second +quota or sleep loop: concurrency1, bounded bytes/time and existing Access authority +are the initial load controls. If an actual availability requirement demands a +rate quota, admit it explicitly; do not invent a magic threshold here. + +No automatic retry for any mutation, including connection loss,503 storage or +commit_unknown. Agent resubmits exact original request_key/body explicitly to +reconcile existing durable admission. A new retry after failed work requires the +existing approval semantics and a fresh key, preserving failed attempt evidence. +Timeout after bytes were sent is an unknown HTTP acknowledgement, not proof that +no mutation occurred. EOF/cancelled MCP request does not cancel a durable Run; +explicit runs.cancel uses the sole owner. runs.expose_test uses the existing +scope/owner rules, with no invented grant or bypass. + +## Remaining gates and ownership + +1. Parent records selection/protocol adaptation and optional provisioning admission; + full transitive lock/provenance/security evidence and actual SDK environment + consumer tests remain pending. No package installation has happened here. +2. Bridge owner implements SDK stream adapter, optional validation, HTTP client, + secrets/redaction/bounds and interoperability tests. No custom schema engine. +3. Registry owner produces pure declarations/version/hash/discovery and projection + corpus for every advertised operation; existing domain owners stay canonical. +4. Runs owner adds stateless bounded artifact segments; unchanged full verified + download remains available. Segment responses explicitly do not verify the + whole payload; independent client hashes full reassembly before use. +5. Access/public integration owner qualifies same actor/scopes, forged review, + holdout exposure denials, grant/revision/idempotency/revocation parity; registry + metadata never authorizes operations. Include real owner setup via existing UI. +6. CI/docs owner keeps base app dependency-free for agent extras, adds explicit + optional environment tests, and documents bounded supported matrix/exclusions. +7. P6 completion remains gated on actual preceding milestones and real public + workflow/SDK conformance, not only source preparation or mocked HTTP fixtures. + +## Advisory review and superseded candidate + +The initial1.26.0 candidate was rejected before installation after checking the +official repository advisory API on2026-10-13. Select1.30.0 instead: the same +public low-level API, Python>=3.10/MIT, and2025-06-18 support were inspected at +the pinned1.30.0 source tag; both selected distributions exist on PyPI. + +Official advisory feed: https://api.github.com/repos/modelcontextprotocol/python-sdk/security-advisories + +Relevant published affected ranges include1.26.0: +- GHSA-rwrf-2pqf-9j8j: client tool output-schema remote $ref retrieval; fixed1.30.0. +- GHSA-84m7-p3x7-pcfv: HTTP session retention; fixed1.30.0. +- GHSA-w4fh-qvv9-3v23: HTTP bearer resource audience; fixed1.30.0. +- GHSA-5h93-6whr-6q8j: HTTP redirect header/body leakage; fixed1.30.0. +- GHSA-qx49-fqc8-xw99: OAuth client authorization-server selection; fixed1.30.0. +- GHSA-fmmv-w9g8-j3gc: HTTP/OAuth body bounds; fixed1.29.1. +- GHSA-vj7q-gjh5-988w: WebSocket Host/Origin validation; fixed1.28.1. +- GHSA-hvrp-rf83-w775 and GHSA-jpw9-pfvf-9f58: experimental task isolation + and HTTP session principal binding; fixed1.27.2. + +The feed's remaining older advisories were fixed before1.26.0. None of its +published affected ranges includes1.30.0. This is a bounded advisory review, +not proof of absence of vulnerabilities. HTTP/OAuth/WebSocket/task surfaces stay +disabled; our registry reference refusal stays necessary even with the patch. +The official jsonschema repository advisory feed returned an empty list; this +is likewise limited evidence. Full resolved transitive advisory/license/hash +review remains required before optional QA provisioning. + +Base app Python is3.12.14. Its requirements remain Pillow>=10.2,<13 and +psycopg[binary]==3.3.6; the optional bridge never alters these, trainingvenv or +captured runtime. Provisioning and tests remain blocked until the root owner +announces the active benchmark terminal and dependency resolution is reviewed. + +## Resolved optional consumer, after benchmark terminal + +Root announced the actual P5c benchmark terminal/completed/drained before +provisioning. Resolution used pip25.0.1 and CPython3.12.14 on Linux x86_64, +PyPI, wheels only, in task-owned `.venv-agent`. The exact29-package closure, +wheel URLs/hashes, interpreter/platform metadata, declared licenses and advisory +results are in `p6-agent-dependencies.json`; `requirements-agent.lock` is generated +from that measured closure, not hand-selected transitive guesses. Its wheel hashes +qualify this Linux CPython3.12 target (including manylinux2_34 cryptography), not +unmeasured Windows/macOS/Python versions. Installation uses `--require-hashes` +and `--only-binary=:all:`. + +Every selected hash was matched against the exact-version PyPI distribution +metadata. The version-specific PyPI/OSV-derived advisory field returned no known +advisories for all29 selections at this check; this complements the official +MCP/jsonschema advisory review above and is not a universal security guarantee. +Declared licenses are MIT/MIT-0, BSD-3-Clause, Apache-2.0, PSF-2.0, and MPL-2.0 +(certifi), with cryptography offering Apache-2.0 OR BSD-3-Clause. This isolated +consumer retains installed package license notices; no modified dependency or +redistributed bundled executable is claimed. Those permissive/file-copyleft +licenses introduce no source change obligation for this separate original bridge; +future redistribution still must retain applicable notices and satisfy each +license. No dependency source was modified. + +Base app dependencies are installed separately into this QA environment only for +public HTTP fixture integration. They do not become agent-lock authorities, and +neither the original base environment nor scientific runtime is modified. diff --git a/docs/plans/generic-scientific-projects/reports/p6-verification.md b/docs/plans/generic-scientific-projects/reports/p6-verification.md new file mode 100644 index 00000000..687c3e2a --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6-verification.md @@ -0,0 +1,140 @@ +# P6 focused verification checkpoint + +2026-10-13. Canonical plan: [generic scientific projects](../plan.md). +Admission: [P6](p6-admission.md). Contract: [agent operations](../../../contracts/agent-operations.md). + +The scoped agent interface is implemented in the isolated P6 worktree and its +focused checks passed. This is a reviewable implementation checkpoint, not final +P6/G5 acceptance: the final full regression/CI remain pending. The read-only qualification against +retained real scientific Runs has now passed. No merge or deployment. + +## Implemented boundary + +The stdlib-importable registry publishes versioned request/output schemas, +operation names and a deterministic digest through authenticated HTTP discovery. +The optional MCP stdio adapter uses the official SDK with protocol2025-06-18; +it calls the existing loopback HTTP owners and opens no catalog or scheduler. +The agent-only client checks catalog identity, live authorization and registry +agreement, bounds framing/deadlines/response sizes, and never retries mutations +automatically. Standard Draft202012Validator semantics are preserved; stricter +integer/source/revision checks stay with domain owners. + +The admitted matrix covers all eight data kinds and twelve draft annotation +tasks, bounded native imports, proposal draft decisions, canonical release +preview/freeze, graph editing/preflight, exact owner-granted external submission, +status/progress/cancellation and explicit scoped holdout exposure. Human review, +credential/grant issuance and ordinary owner-only retry remain outside agent +tools. External new attempts require explicit new submission and a valid grant; +identical-key reconciliation creates no new attempt. + +Stateless artifact segments retain the existing Runs owner and explicitly mark +whole-file identity unverified. Client reassembly must verify the final complete +SHA256 before acceptance. Existing full verified HTTP downloads remain intact. +The new segment path does not rehash the entire payload for each chunk and does +not create a bridge-owned file cache or arbitrary filesystem operation. + +## Recorded focused test runs + +| Suite / checkpoint | Result | What it establishes | +| --- | --- | --- | +| `test_agent_api` initial focused suite | 14 passed, zero skips | Registry/schema projection, stdlib-only import, bounds, authentication/configuration, framing/deadline, no replay, hash checks | +| Agent API post-integration fix selection | 4 passed, zero skips | Raw-base64 image projection; revoked discovery preserves401/code; schema projections and framing regressions | +| `test_mcp_stdio` final NUL-framing revision | 13 passed, zero skips | Official SDK subprocess lifecycle, fixed protocol, typed tools, bounded framing and errors | +| `test_artifact_segments` | 5 passed | Exact multichunk reconstruction, linear selected reads, mutation/nonregular/size refusals, revocation and cross-catalog denial | +| `test_agent_http` | 3 passed | Authenticated registry discovery, real HTTP segment/restart parity and exposure eligibility denial | +| `test_agent_workflow` + `test_agent_domain_parity` | 3 passed | Public stdio/HTTP workflow, all twelve annotations/native variants and real authored classifier holdout exposure | + +These counts describe recorded runs, not an additive unique-test total. The +four-test post-fix selection overlaps the initial suite and includes newly added +regressions; it is not a claim that eighteen distinct client tests ran together. +The initial agent suite took16.598s; the affected post-fix selection took10.884s. +The final protocol module passed13 tests in8.052s. Other timings are not asserted here. + +Public workflow coverage used isolated fixture catalogs and explicit owner +HTTP review/grants outside MCP. It exercised draft→owner review→freeze→graph +save/preflight→grant→agent submit, two distinct real neutral executable Runs, +same-key reconciliation, artifact reassembly, cold reopen and credential +revocation. Native import/annotation parity covered image/text/audio/mesh, +pointcloud/volume, sequencev1/v2 and project scientific fields. A separate tiny +real text classifier established positive holdout exposure under the existing +`expose-holdout` scope; this is not a scientific surrogate benchmark or GPU test. + +Two integration defects were corrected before this checkpoint: image transport +now forwards raw base64 expected by the existing image owner; discovery auth +failure now retains its actual401/unauthenticated response instead of being +misreported as registry_mismatch409. A successful unequal registry still refuses +mutation with registry_mismatch. No domain authorization was relaxed. + +## Dependency evidence and remaining gates + +[Dependency decision](p6-dependency-review.md) and +[resolved artifacts](p6-agent-dependencies.json) record optional MCP1.30.0 and +jsonschema4.26.0 with a hash-locked29-package wheel closure. Provisioning occurred +only after the P5c benchmark was terminal/completed/drained. It used the isolated +P6 `.venv-agent`; the captured scientific runtime and P5c source were unchanged. +The measured lock is Linux x86_64 CPython3.12 evidence, not cross-platform acceptance. + +Still pending: + +- Final full regression, independent final integration review and hosted CI on + the published exact source. The task integration owner records final status. +- Final integration of the separately tracked legacy actual-v2 packet gate; + P5c scientific acceptance is already complete and published in PR52. + +This checkpoint establishes bounded transport/domain behavior, not scientific +correctness of a model, source authenticity, remote multi-tenant security or +unlimited HTTP/UI parity. Inline imports remain512KiB/1MiB request bounded; +HTTP receive16MiB and encoded MCP32MiB limits are client restrictions. Segment +bytes remain provisional until whole-hash verification. No additional scientific +Run, new model fitting or evaluation was required by these focused P6 checks. + +Final independent protocol review found initialization metadata could contain NUL +although the framing contract promised rejection. The framing owner now rejects +NUL in every string/key; the final 13-test stdio module passes with no skips +(8.052 seconds). No scientific model acceptance is inferred from these tests. + +## Actual retained scientific MCP read + +Official SDK qualification passed at source b02004a with 22 real MCP operations. +The retained P5c checkpoint (272,149 bytes, one segment) and scientific chunk +(38,196,421 bytes, five segments) exactly matched the previously qualified HTTP +inventory and complete hashes. The pressure slice also matched prior HTTP. +Runs, graphs and the reviewed record remained exactly unchanged. The inspect-only +credential was revoked and both server/stdio processes closed. This proves +transport parity, not another scientific/model acceptance run. +[Receipt](p6/scientific-mcp-receipt.json), SHA256 +`f99cdd6654c5bd3a9271e6e79bc99aa0fed1c53bf36066f39099f74e52f920c2`. + +Source is published as draft [PR53](https://github.com/MrScripty/Tuldok/pull/53). +Final local base, optional and JavaScript regression is running against the +frozen source. Hosted UI38474544619 passed; lifecycle38474544623 is pending. + +The first base-only full discovery exposed missing optional-dependency skips in +14 client/schema tests. Production discovery still imports without optional +packages; the bridge correctly reports dependency_missing when they are absent. +A test-only correction is prepared, preserving cold discovery/config checks in +the base environment and qualifying all agent tests in the dedicated SDK +environment. The failing discovery is not counted as a passing final suite. + +## Base-environment correction and recovered final run + +The preserved full discovery completed900 tests in1,324.060s. Its onefailure and +12errors were confined to the optional-jsonschema client tests; all336 inventoried +source files remained unchanged. The test-only correction adds14 precise skips +when jsonschema is absent, retaining two base discovery/configuration checks. +The corrected base module passed16 tests with14 explicit skips in0.042s; the +dedicated SDK environment passed all16 with zero skips in15.356s. No production +runtime or base dependency was changed. Remaining dedicated/SDK/JavaScript gates +and fresh hosted full discovery determine final acceptance. + +## Final local affected and optional gates + +After the precise test-only correction, all remaining local gates passed: +dedicated point11/volume9/training12/evaluation9 with zero skips; official-SDK +agent22/22 in46.420s; MCP13/13 in8.047s;56/56 JavaScript/syntax commands. +All336 source hashes stayed stable during those gates, with the intentional +API-test patch the only change from the original full discovery inventory. +[Final test receipt](p6/final-test-receipt.json), SHA256 +`7b1de6a33f76b3cf08ad45a91af346bfbb5ff13840a459937d73b5f4120e979a`. +The failed original900-test discovery remains recorded; fresh hosted full +discovery on the patched source is the final regression acceptance gate. diff --git a/docs/plans/generic-scientific-projects/reports/p6/final-test-receipt.json b/docs/plans/generic-scientific-projects/reports/p6/final-test-receipt.json new file mode 100644 index 00000000..b8ddc0d5 --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6/final-test-receipt.json @@ -0,0 +1,1362 @@ +{ + "started_utc": "2026-10-13T22:23:36.750290+00:00", + "frozen_source_head": "b02004acacc87a0d9cf66edf10b492d8845f0976", + "original_receipt": "/tmp/tuldok-p6-suite-source-files.json", + "original_base_result": { + "label": "python", + "command": [ + "/workspace/Tuldok/.venv/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests" + ], + "log": "/tmp/tuldok-p6-full-python.log", + "exit_code": 1, + "elapsed_seconds": 1324.8069455040022 + }, + "original_source_files": 336, + "test_only_changes": [ + "tests/test_agent_api.py" + ], + "before": { + "access.py": "50681dd5b2aaba01a311a7465b15161ca264fa4ca9812b95f15914adb5d808f4", + "adapters/rheon/cpu_compare.py": "e2e14eb6f354b88a0123bcdd710d4f990102efb97f7cdb584db4700e7f05ab97", + "adapters/rheon/cpu_project.py": "fe22a72b6dfc1b703c5407ba5691cef2117f6d5adeddf0d504f5c94270c003cf", + "adapters/rheon/cpu_train.py": "ea3c9524f5b1ec32e261865c1f24e06a2ff03ad97d1ba040ae7e69c48de39238", + "adapters/rheon/cpu_training_project.py": "484fc46f4c81002a213a9e39c50ca0f43bf60c7c0c030376ac5e81deab2080e1", + "adapters/rheon/evaluate.py": "ba212546b6bbe404ed88913647a8454c0f7413558e02e638aad7096eba4b2798", + "adapters/rheon/evaluation_project.py": "2409e7cd9ee3768b6f01dba03e03fdc6383b294357c276d07c0dbb1009f2aff3", + "adapters/rheon/generate.py": "c50277e7121de8153e8056e83e67b20aa610c335eabccd2b229ae475313f0d9c", + "adapters/rheon/native_transport.py": "4155a3467052b291cea0bd8a9018122796851c0fc8499d8866cca28a2fdf821c", + "adapters/rheon/project.py": "cb68c41ec431078a5cd6be1615176867bb386afc25eb247f4888958b0ed73ca7", + "agent_api.py": "951e9540d31c8a4f4e8646dcbcb85dcd32460647f3e7d28d353224f5af1c6c7b", + "ai.py": "a3b04a3015496ff3c66c3eb450ccf887bd5726229669ac0515d95a2761ad3a9a", + "ai_codex.py": "debd26342e73a87635d772e3ee59d30bb822877008d667b47997f52e22f94f16", + "ai_http.py": "73ca648fe00e8f5a4022b14b72c80dd695228706a0f2b79aee605a524b8f2585", + "ai_openrouter.py": "70930124fac7ef08941f571c1d4492f72b29aa94807cfd5d66bc32555432b160", + "app.py": "80a4164bac0dffec432f63d121921986f6d077a377692f5dba0346eba1dbb649", + "audio_assets.py": "d69bfa94037ea132be4adebba26c4389d58925a408f2fc27c6984a71fc8dc1cd", + "audio_classification_export.py": "0f0643470cfa3b015c2d56c0e8e1dc2ad4944bc825127b9131fbbdd36349052d", + "audio_export.py": "bc20d32089b3a004504c6cb072e18db9e285c9195db84679670fe460ef51cfc9", + "audio_training.py": "fd5a21f1bfbfbbd72f8ba5a3bcc88017e2b8c2f075a7a6506310a01156f771a7", + "backup_metadata.py": "15fced02dbc6da6b035b2ab7fbf5bd368ef862d0d03eb01561781d09fb921f0a", + "bulk_import.py": "b8f7c55947cb82689850716b5a8f6f95422efde2e87c4fa3c640af004b8a2fdb", + "canonical_release.py": "1f92e2d822602211475a5e7c13198388cc0a36aa36e0872f66d9fd353dcc2061", + "caption_import.py": "86496e5ccaa5dbbf32d9731e7acfb76cc5c0b6a147e333e9a53aa8e9629ca406", + "caption_proposals.py": "a74ca7993b6f3b7dc7fb867a871148f04c743c048a1e988ab517554a35ae901c", + "curation.py": "b25576749afd01f9e699133c5db7e6113f9a5f0ad8961dafc4084292896b0049", + "dataset_recipes.py": "78ae918228f15f9d5924985075cb96535b8953b4ad5faa821d0cacd0a50e3c88", + "dataset_releases.py": "cabba1d75aa42fe4988a5fabea590f397c8fb1d148af42174bb4a0ed77a065cf", + "frozen_classification.py": "a6a9fc244bcb7de7da5217fb36d5e73bb03ca1756c9c63770c23a78336606649", + "gateway_discovery.py": "8a02e2ef9038859c1accce9ea3e31ea489423f19799a279f4be6f9afd61297d0", + "grounded_candidates.py": "55bf111d7dfe951fea960f347ed4bfb498d15dcc604bf46fb1ae2505cc1354cc", + "image_classification_export.py": "995edefa24fc039505337fd8d2915e45d173c18a03af513d9f5d8eb234225b96", + "image_generation.py": "c3a62b3cf0bf1d6f6d453a63f7f2a7d08de63864d880959bd0eab237d9856858", + "image_training.py": "5a7807f8834f96bf17e1c020357fdb96a7eb1ac94b54a440db80559d9923f99c", + "immutable_assets.py": "672c08d949f964fcd8cebd9a888092ab0163f022542df337e02bcb17f3c477c8", + "mcp_stdio.py": "9c4144cbb50d1144b3989ef8d71ac47e5a57e595cdf94253a5611feea1671362", + "mesh_release.py": "09d29a60bc37826b906097debaf7eb8577a425d3d791ff5df8d3b03607b10de1", + "meshes.py": "abeca65f8a39af57352828169f90f767b6bc770fb5407fb3f18af53be8ff84e2", + "metadata.py": "42559a7efd599f637e6e289802fa7400d59b2915edcf64e3260952d59cd7b439", + "migrate_sqlite.py": "be1a79a1b6f5e2c8e4c99862043a5afcd4f30d6539388c1600908f4a4f3f92da", + "native_detection_import.py": "80466232bd51f58bca9a00ef68e278da087b012e7f1b3b1171e6e51db3b8c572", + "native_text_import.py": "3fc35bc1f04e056a588e8e05f3f7b41ff894c90dae6cee2f1baaf37a7098d167", + "pipeline.py": "cea1522505c72557c793464ecd89a86ddf2b7eef5ed4249a6d1004fe516e573d", + "pointclouds.py": "02d9eef31661dd5a9f0855f8e59d7b839b0ad1590f53a657123a5d9da789dd9a", + "preferences.py": "d6279b18375fa8695584a02cfe962b56e77cf4f3521c5e33cc4baf09f8e4dab7", + "projects.py": "d147c6bae61068f5517fd15e3512311459cd4de3d6edfdd9ea984783470d432d", + "pumas_gateway_descriptor.py": "b9c4259bda856fd19d1d82b3a2c000a74ab3979832248fd3f1f1d3d6309c0752", + "pumas_operations.py": "e8b8acee54a027633ae39f00a23b3d4845ae474d031690134cafb1c75bf73511", + "pumas_vision.py": "5659c7731b5011ff39a0a9b7c27712382983f16286540f47f6b1337941bbda7d", + "recipe_contract.py": "7cb44071fc1bd040d31350b996d43629fc91218c16bd9de2336712193de8e215", + "recipe_process.py": "9bf5de04bef27a86ad239e05d9d105985d966a2b114350c3c8e3a92053b1a999", + "release_validation.py": "a04e0f3c941256422b0c3a8c28665b6fba025df9d3cfa6cd5d5686e2bb8de95b", + "rheon_controls_contract.py": "25ec0f98f9b0ec576f30793cd24c1dd7b4e77fa7a6bfc6ed323271f829f982f4", + "rheon_controls_sequence_contract.py": "5c41f3a3c848940191d05d9b5b01a2a398b0d2a67f23c603ab8e918897bd3b55", + "rheon_sequence_contract.py": "063d17a3bbc92a27c26c0f5dd4588a9478091ebbf53ce0ccb818cee6a9393b98", + "rheon_sequences.py": "9e3013fb1b5f1baf3de73678a26f964bc2f802435e6fff26476f816847fd22a5", + "runs.py": "ac32ef18e55390a19267e703835730294972608006094e47eb4c22f21548da79", + "runtime_snapshots.py": "dad9e4ddf9c11c0e1f2d5b9a7afd6877e7be375fe02030c65b684bca2b0ef45e", + "saved_searches.py": "fcd4021fc20702568f1e44a165473aa752b9a9794a958ff31b33c42aba7114d5", + "saved_selections.py": "4e89ee272fc8a685ec76b3737879d6560661a73e03fca264c2057785905418a3", + "scientific_fields.py": "19b63cf1c65335b55a907c84312f0f9be70de1aa79522d96ec38d4862fa55338", + "scientific_release.py": "b419730e7cc00212632b3adcdf63997343b6fb9aecd07a6ad2cb6f5c1728fb60", + "sequence_assets.py": "3ac8361f5e24f6b2af93dbd9030bab864da7bddb32da975d937e852d89fff98d", + "sequence_batch_import.py": "3e7af45744ae7f8393059715dbf7012567d0bbb528c3682dd1b992141ae32b10", + "sequence_release.py": "3d1bac3c2d78d75e08337b0659e435fc81c32c7625d8244be4d41f2ecb9e831c", + "spatial_assets.py": "fdd3715025426024a4c8fa1704645d98940cab7e6002846b9e72a54352fe6ef8", + "spatial_release.py": "4d6ec06fceb72257a9d25da09ab24bcf13fc38f66ae50e8b39d5a5796f9b357c", + "static/app.js": "b82969e67e7a7792a11f239eff2fec959158e1dd78d08a84d68daedb93aad6bb", + "static/audio-editor.js": "d397bb98480077326b4c96035d891f1d8eb77cef8a04f3b2aef1eb34d5bbcf40", + "static/auth.js": "6a38fa7dabf57b2c99d293c6851a732af76a19193bea43f7d2a8b8460d71faec", + "static/bulk_import.js": "2d19443342dad5d083ad66e32f5b4877a825296f1a41d8996befd336cec7d367", + "static/caption-proposals.js": "09906d8ea799ee7def657a5d1c7746a5dcbe25797f7849c7ac27364089a083d7", + "static/caption_import.js": "280a116a086c3e8c69fcd17e24aba6630bb6c3d3c1e653a5ed84c184895ae850", + "static/curation.js": "2f51c2e063eddbe16cb92dfcaa96c35c749dd61960ebd92c8c538bf0c6ff389a", + "static/instruction-responses.js": "3fb4fb8d78154bedb37ef90afbcc269fdab0938c4ac50236f38a7f26f54ac940", + "static/meshes.js": "c2eb7622dd4e0a172db9db36e46a0ce66800d5b03aca989cd1f08dd40b8558c8", + "static/native_detection_import.js": "b07d3a9663d5b1534fca24dc7481caf4cb166bb4a83c4c97c2a78fb9c8d50d82", + "static/native_text_import.js": "1704549e9e5cf489e6351d5126858eb774ddd94d060e596a0bfba5fc00ea8773", + "static/pipeline-editor.js": "2272f1a9b106945203112a46d73643cc5d4dbbfd92f0d7c09d1cc36a713042d2", + "static/pointclouds.js": "34851447f34ea0204887b6aae4a86d73f6f94c8d1726b8e82b892027336c0c84", + "static/preferences.js": "fb22c04b6856d33b7e298aa1989d073c937ab40020025f39b86daaff62b948f7", + "static/pumas-gateways.js": "02df8f34362fc2e32f6a4582a9cb71adaa5d7b83ccd897803b9e1d02c7bcb932", + "static/pumas-typed.js": "50fd9fc961dafdd0c34cfcb1137d04f85a99f324f76fd5217f227b789c8835ad", + "static/rights-note.js": "fd09cef5c52b2635ad42998483c7054260140459444fbd948bb596e5966feb11", + "static/runs-view.js": "7568b843ad9b56c1c6878a9756553cdf8092dea3b954aec1947b8f32d730ca85", + "static/saved-searches.js": "49210b9da9dd7f7372e977c15543a77c5ada1df82ad9abdcb350026e16517892", + "static/saved-selections.js": "2c2feecca798217644247f98aab8e7a00d707a25d4af75e02f9d906ccbd905a3", + "static/scientific-fields.js": "96e6289ade2a634e9648cbe8aa899e5bfaddacddcea120835bda8cb6d65e14a6", + "static/sequence-batch.js": "36bbbdc07cc3a03856e6072e4141545c1c0f202805faedec76a2c7f20c0850f7", + "static/sequences.js": "0f0ce113a0e2e3e3160f063ed577f882fb7d53d156f517ed46920030f1c0d17e", + "static/text-classification-proposals.js": "03dbec1114700f383f8bc9883c8a4cdaae59d898fc44240022b2011893965d6f", + "static/volume-editor.js": "d48806cd446ea05586b524c24340d87abe8c69063ea6b15c254f76b3e51c5db8", + "static/workbench.js": "7e31b8a0e916f1627cb523d84c6d98c732eb739617b3f3856cbc1c235a6829b2", + "static/workspace-external.js": "e05d699a6f11273a3f7a2c15236c72ac947e559381142eed2b42fe473c90ebe0", + "static/workspace-projects.js": "4a5e2e4c61cea0cf9f3a30772cf5f47408c72a77d6fe2afe63a2717e83157b7a", + "static/workspace-real.js": "5ef1571fe03a0b234a1469d9031432287877fd0e15131ee3aedc04d7207d9a01", + "static/workspace-service.js": "9a924f671f604221de3c055a75da2fce3a82666d4090cf50477ab757032228bd", + "static/workspaces-data.js": "da2807d18da4ef4c366bb178d30b336d0b9896fd349b76dd97183e7237022dd7", + "static/workspaces.js": "33eeb0ed47e1f6d8b651edc473d44048d8d7b872d581c19960a023a0bd0fda25", + "synthetic.py": "dc55737b0f55ff4ec8df56a3d6b4f4596f5067bfd75672ba6326453047cab5e9", + "tests/auth_helpers.cjs": "363ae493c121f2cc5e804c3774d6ee4c2078ccc936db1c37ddf749cf9b4e1a15", + "tests/auth_helpers.py": "27a40542686a8a56df04601d765b0d4bf815d65d327b49931696a0ed161b5a7e", + "tests/browser.cjs": "c4c5ae4aaa227207258be2f7ebd68e4d4ff046dd14c170ce8d5f60203bb25208", + "tests/browser_access.cjs": "b19ba3559cc8321c3a4d932f0c14a08c3763ca41ac8640fd965d346f95213159", + "tests/browser_bulk_import.cjs": "a7c8fea60c9a08b808cb7f26ec94a83be2b20f72b2605a5fe81ec5ee1de919e3", + "tests/browser_caption_dataset_integration.cjs": "02e531b8c183c2a6f6cd1db88b24dfe686bf65cfb5236e85e67b337f9bcccddb", + "tests/browser_caption_import.cjs": "1fe190836b28bbbe75e4ad037ddc105ab8274e4b58c94976c0bf56f963fdae5c", + "tests/browser_caption_proposals.cjs": "1e41aa2e33f0caca0bc23ec447710f9694535c303fadb9717c188c8c0dd3c78a", + "tests/browser_caption_proposals_server.py": "b131aa4b8732ccd465b5b6c8ae9afc89365e4ae70375fdc0fb239df5e6bb7b06", + "tests/browser_captions.cjs": "de73a2a845e503aa2c402e7be826fbe8a2d2c2e97b6c87967036436943ff54cd", + "tests/browser_classification_preferences_integration.cjs": "876fc48921112ad014cc2b406756100680aaf73a6a622ca9e78fcf4715c67898", + "tests/browser_combined_workbench.cjs": "775809ee600a2df52cc691cf05c16bf895a98635be05ba859d4ebdf06b048631", + "tests/browser_curation.cjs": "e6de80c9dfda22bbb81be8935903705320c94c7a8395fd062d9bb908976f677c", + "tests/browser_curation_server.py": "812eb92ca91e0c14e6a02a753e1554e5c499b198d659c90036fd2ee7ebef80d5", + "tests/browser_dataset_integration.cjs": "8145f21e137397111241495c21a80a96ff7b3b758698afa9ff51a6f1b0615d4c", + "tests/browser_grounded.cjs": "47eedca6a53ecabffe35155d7f53c1bce7b73cb390d306860b65a108be558d8e", + "tests/browser_grounded_server.py": "afa77db2d8d4ce01e8257c5d3b5a35cd2dc78bf3199cc306b307341748b170ea", + "tests/browser_image_classification_export.cjs": "3315d2eebeceef30f4789e6b1c9995e82d789c171c6fc13e8401ce276966a4c8", + "tests/browser_image_classification_server.py": "f5f3c3512823298afd6ea110b74bd617ef814e6e0d29cd35cd728760cbc32c34", + "tests/browser_images.cjs": "007da417cc70a024fb58ad35d741eaeecdedcced9e25f47ee3fa37ecbd4a3ab5", + "tests/browser_images_real.cjs": "a089ad6ca6c2ff189977b35531adc0af91630444b49f2ccfb686193e421d210e", + "tests/browser_images_server.py": "1375a6a1d9e2727949254de9286fe0da51b69cf5cc55709ef5a9430c7cd0eb55", + "tests/browser_instruction_responses.cjs": "db3713ef4a33391255f9ab3657ed2975e4c6bad144e84e78ef34b0695254205b", + "tests/browser_meshes.cjs": "f75733354082f24e3d3f369eb40386599705fb1b09c08e17cf2a005c16844dae", + "tests/browser_metadata_filters.cjs": "e8b88df0932f03cd748b47a23343545f5461dee48813934cb631e79c7d39ec0c", + "tests/browser_metadata_server.py": "7aa0e25bae8eb5bdd523ea1b568e5ac60d9420e3aa8acd97750f95053f07f053", + "tests/browser_native_detection_import.cjs": "8b45927d506612925aaa3d9bf47646031de1e99d43e6fb42293bff01bed5ee59", + "tests/browser_native_text_import.cjs": "5f8e5f2d20a66e35784702a37706b9daac53e73ad1c1e9719978086122e957f2", + "tests/browser_page_load.cjs": "bb74bd6ad97e0ff7c4545c747df698d0466d143764b0ccb52ed26b2051a13318", + "tests/browser_preferences.cjs": "63977d6ac0eaa390f5472cfe86a1943ebf07a6f1e32cb8338bed0128a4b4f70f", + "tests/browser_pumas_gateways.cjs": "e7659f2598680c15c89129df8e05ba4bd8019369d7fb03566616a2091f43b3c5", + "tests/browser_pumas_gateways_server.py": "c17a4b267ea2e1385185f94685eca893691a8f966f46b89c3084e7ba8e8bdc3d", + "tests/browser_pumas_typed.cjs": "9813559dc88426a088e750d785ceaf0c4ed8458011abf58c6f20812613dc8883", + "tests/browser_pumas_typed_server.py": "fc729ef0b1e4cc107dab0fe5fe8a4b2e09fbb97d32f4f282ce5960f7e9f7ea35", + "tests/browser_release_preview.cjs": "bc990461fa95e59d87d75a0185e5fe16685b641ff9e24379f214dc582f558c3a", + "tests/browser_rights_note.cjs": "bee20ec43752ce03b274ef5b4bb35f3b9af1179cb0a723c4bbe081ef80a7fc6b", + "tests/browser_saved_searches.cjs": "6eedc0491497dbec262943cc0d3b0bc1b0aee959f1f4cd4dfe8b53b8cad94b25", + "tests/browser_saved_selection_intent.cjs": "381a2040096227ec0854f2b21519b29e086267e3bc57eec225977152d13821ca", + "tests/browser_saved_selections.cjs": "05276e39fc3744e969999f43d5f6bc9aa1a96c5b7b7e1512a80f111f752594e6", + "tests/browser_scientific_fields.cjs": "cd67c773023520ebad8ac54d09b0f4f0fb8f3bcd78eed6a8942bd6bcce24ac3f", + "tests/browser_sequence_batch.cjs": "eca3a2f69a54919394452dd8703e0584698af4c6fe6712571c69414169cd460a", + "tests/browser_sequences.cjs": "b84c8b41242e0b7ed125251d255de21699cd308e2a94fe755119438062576009", + "tests/browser_sequences_actual.cjs": "60c68f3c637cb394199e9565410981ccfe3daf79dd7b6e7e859df81ba5864c3c", + "tests/browser_server.py": "6c3d57a4e5b5fe75ab866fcf35dc5450a98ed0170d0fbcc03d10f40761dc8d89", + "tests/browser_startup.cjs": "ba7e6c8817489ec6d41b994e57a4f01029e986d2475162fe3b5cc971e6ccf634", + "tests/browser_text_classification_proposals.cjs": "4b2ce497d61759983d1182bc92fb6f2d19f7f84a12897ab28e14efe1b7373bc8", + "tests/browser_text_classification_proposals_server.py": "c21f65529ad95962d295153c0a1f7cb29f03937f1496efa02ea3add4a5f14203", + "tests/browser_text_corpus_export.cjs": "301577b087eb14f8520b93a795d5054f0b128603499dc229a675f9eb40359ea2", + "tests/browser_vlm_real.cjs": "52abd3b48dda40daf5a5efb207c83f5be286b49abda56d44adf1118a82ccff86", + "tests/browser_workbench.cjs": "c7a29ec267bc49c82777bea81af99caf38ea0a7eb0f9b7f7d1bc50d86d4fa218", + "tests/browser_workspace_audio.cjs": "e583d9beaddd01ebb799fc9d82dccd08d6e03f6adbfc53894fafab55436f3b36", + "tests/browser_workspace_audio_run.cjs": "2a15d61e0c1f9e46bd2c8c30e7cd2bcf36a31e0c11a50d1b5b0e9e9ef911f3b8", + "tests/browser_workspace_breadth.cjs": "6304ee3e1065f4fa1d6e52afad51905081f9590792671d37083ea7f573b0d8ff", + "tests/browser_workspace_cpu.cjs": "6911c8b4f568cedcd9691fbe53d2837ba344fb08f423406e9ddaf4114457557c", + "tests/browser_workspace_cpu_training.cjs": "2fec33e09bc63115f2c743370c131e663446dd919aea8516a068aa4599eb8306", + "tests/browser_workspace_export_run.cjs": "fd7737ab67642af283787cbcee8038bccb28660cfd73ac5fed206ee67387a41b", + "tests/browser_workspace_external.cjs": "56f1c7485c4b6fc1181317df93bd370584250426f46c7c6568e1182f7237f8fb", + "tests/browser_workspace_image_run.cjs": "a6156cfb2b3fc70b952e1e7b1be6162d010f064216b655fa5e524be64fd52e1b", + "tests/browser_workspace_mesh.cjs": "23d10526afe02d3564ea508f284e4f8f1526a05e5951fd0427a03457d678e882", + "tests/browser_workspace_mesh_run.cjs": "161735e1dffd95e325f00e4e8476d4de5d1322e11743590d81533698da6ae8bb", + "tests/browser_workspace_native.cjs": "f38102f33e22555859fc49996396ffa73c11d9282469cfd25678b3a904aed645", + "tests/browser_workspace_project.cjs": "6c26a5db25c7e4b9cf01f3defe0f2f6b7b4158074b8bd3487e33b53b2f0de9e8", + "tests/browser_workspace_recovery.cjs": "6508a410717032d2806588504e756325358503a60fc0144c186f1058f612b568", + "tests/browser_workspace_rheon_evaluation.cjs": "333fd9e9735499caeb79d5a1d498a48a16e97758d7914c3e4e7f5c8dcfe66145", + "tests/browser_workspace_sequence_run.cjs": "ecc5aa03a7be9d850d7904ec703958c98d29995b9ee5449774c417a895498400", + "tests/browser_workspace_spatial.cjs": "6a32f7d5c1a7c07338b3c915ca181956140076ddcd907883924e906ed920f16e", + "tests/browser_workspace_text.cjs": "ed4ecd4913a893b5e170ba9e20f78d6d29a4ddb125c0f926996350dbfdced1b5", + "tests/browser_workspaces.cjs": "e40c459a2aca337ffb9043762e8eda4e7c483ac1de816210aa068e368198c191", + "tests/check_image_classification_consumer.cjs": "c51342eba4486e6e7f48377ebabfed9dd2b11d401822eb8323d7f7e4c1aef683", + "tests/check_image_classification_consumer.py": "b8894a0c903ede4217671d817ef4a1ccc081d1f6f8548d99d7c24d375a882697", + "tests/check_instruction_consumer.py": "d2b38df86311be0011aced1046c0fd7a7e8f667dee9b1e783a1ff9a189aab5d7", + "tests/check_preference_consumer.py": "9b33ca4300fe6eac6fea14a1b2d24a598a7b50a60dcc81f224a0c1b0296bbf1c", + "tests/check_text_corpus_consumer.cjs": "d6a851b1ff40fdc1407b2e3807b93d8b2b7dc727d648ec0b3493484d3e031190", + "tests/check_text_corpus_consumer.py": "00bca07ab03912f4e6208c22aba1842b3a0b98111d28bc443d3ea94e0bdd0a26", + "tests/fake_ai.py": "2eece3243b9c1594b7ed0f0a0dd9f20a453838d2e6b73ad058e217f688631a72", + "tests/fake_ai_codex.py": "31ec8bebf169703cae1db8936c84ae983e57ba7d7dfa937e57bad4e575e41b88", + "tests/fake_caption_model.py": "61a34f2584ce3f3de64075478103422fd04e562649875de97f4e029dbceae7b1", + "tests/fake_classification_model.py": "27cb688d1f1c6d55bc742f8265c7a634133c94d94d4758b691e2b45b03fb7ab5", + "tests/fake_grounded.py": "1edf38662b953dfbb6b3ff0460320b820d7bd6b6bbc6c07157835f3aa5a4afb2", + "tests/fake_images.py": "c4a532a749211c6e67a5f7444eee698c8ac51f28cb3f636ddfcc6a9f1f5e4816", + "tests/fake_pumas_typed.py": "95d0a2e8bf652e6f5165a8c2a9a2a5c2e7378c7680cc3e8c615e431210ae07f1", + "tests/fake_pumas_vision.py": "bcdb4abf3ff170f26f6798a306db77f8ec3c370843905ac816e17b8593d47ddc", + "tests/fixtures/diffusion_check_image_data.py": "6a4394308a4cc69b4ca965aca7f8459d7711ac9d51ce70492562c6ec6d806f94", + "tests/fixtures/external_recipe.py": "06815b425a7722e0aa64d0c8739263fc2db371027b382d0c3326691305e1879c", + "tests/fixtures/image_classification_fixture.py": "1e547f650f20e157eb0b3914213b9bd3ad26d989dabffbc975616b0d8fce77b8", + "tests/fixtures/pumas-typed-v1/harness/probe_gateway.py": "79a4e88223fc94517ac00e8bf1f3a3d005fe2f12c527dab436d6c6e916567f5f", + "tests/fixtures/pumas-typed-v1/harness/serve.py": "f3a7debf3a0ab69537cfdf3e9e51222c6ea322cbd47750a20aeac3f2dfacde69", + "tests/fixtures/rheon_controls_authored.py": "385e20e96d0d0216662477491365490dddf5e6d693ced1ef5ac3845b3a9a3d8a", + "tests/fixtures/rheon_source_derived.py": "884fb395fccc7f9f4b0ce82675eba5aec2621887b4ac1d93b71f2ab0abc99d3a", + "tests/fixtures/text_corpus_fixture.py": "6d1cbef5f8f725bd75e16e9190160002f273d80d9e95c654e78ceda35c9c7d0b", + "tests/fixtures/tiny_transformer/model.py": "d304e951615f3bcb9cd5f4158b7348c5ecfd68731d8a5d62bd0d98e837dd1784", + "tests/fixtures/tiny_transformer/train.py": "8d2b908007dabbbd609312f1a22a697b40534b6c5ab07e3d540fd5833295e47d", + "tests/fixtures/tiny_transformer/use_model.py": "34b94d2be0a870fc470d27e61738e7ff193b586122b72724f7a33f2688099957", + "tests/fixtures/train_image_classifier.py": "a198463590d41660c21ae45313b47c3a5baf38889eb9bc029e4c7fe8aa741ac1", + "tests/fixtures/workspaces/audio/classification_fixture.py": "39af3d407b76cc64625e838d78f6e55208bd0f55f6f36ecba3167a7f1b786dd5", + "tests/fixtures/workspaces/audio/make_fixture.py": "6189d6dff75ca84240f1df5a1442d4ab25e4339431c985de25085d7bf41a4e58", + "tests/fixtures/workspaces/image_corpus.py": "16f829699fc2de257bc8acf672af1d143bf74fcfbff33f030664e2745d958429", + "tests/postgres_helpers.py": "eb8398f68b17d8f84309941058872c2d80d73d09e63c2c8cb4af4d8ec59c22bf", + "tests/qa_artifacts.cjs": "592a98a1928f5b791f37fe13b94b5065a293af4c570bd6c3df449bf10ede5927", + "tests/qualify_agent_scientific.py": "da48fbc0c5e02992f911c54608ab5487014027c222bbf247bad8867db932c15e", + "tests/qualify_captured_cpu_runtime.py": "36198b4d7935d31997e4ec5ed48b96a1aaefd4f284c1f737e1b00c840cd386e2", + "tests/qualify_cpu_comparison.py": "ccf1d67354b3898fe6eb2f142c5c5e7665318f218df193259d43843366b436ed", + "tests/qualify_cpu_training.py": "5864c766530180e02cdc8e6a3839df4d6fc56fe42921fef66dc4815bae0f45fe", + "tests/qualify_native_generation.py": "add38a6aa55fbf42dae1508e5c602a512057250a332a27fd878148736aa07053", + "tests/qualify_rheon_evaluation.py": "37b6184a6a36d8f09b16758e7536c015b64fc3155f147b0144b98feaa29b6de5", + "tests/qualify_scientific_fields.py": "8418dba5856172d891375935b0b51bb2ba518db9dbadf4a2ecd8dfee5c625540", + "tests/qualify_spatial_retained_runs.py": "2c7fca75747ab4639c4d9415b6308c7a3a3a46c7a257b76f8d97cb01c32fb358", + "tests/test_access.py": "31a480dfec02e54db48f7a324714a6b101c34193129a71827bcd61e725d813ea", + "tests/test_access_http.py": "25071bf2647fc6d8d3aa6ed525d45f777c01b6a7831f9802958e26a2e57147a7", + "tests/test_agent_api.py": "e457f2c6b1ec5f29632d8b626a03403ae04010f9b080717ddeae1269b92266ad", + "tests/test_agent_domain_parity.py": "7bfdb3259c653ce42a57f1eb6dc11f59209c64b2e3f38ecf9c434d2d900833d0", + "tests/test_agent_http.py": "77ccbd8fc846a832cc3d5e26f5e69fa6c332a1dca9c26add8886f796fe74c210", + "tests/test_agent_workflow.py": "8746878106344a3e28ec199f7280b0c9b3c7f9205b41da84801314083c30a597", + "tests/test_ai.py": "71a1a4b653671ec0c37ecab1a34a69e8e523193741eecfbe1b6298ac8e964aee", + "tests/test_artifact_segments.py": "f4f231c9eb1d2b3e9f478a4b9ee8139f286b3f009290d87f5433a3f97ed3eb6d", + "tests/test_audio_assets.py": "6c63a22d4ba93d41ef0ef6251abb720e50b3c2d240d0fdcd5ae0848d1be8956a", + "tests/test_audio_data.py": "77af876b31b42efc68849b45272b696bf65b8d7b3adf4a125723f14125370f62", + "tests/test_audio_training.py": "1756d9bd3d80202d16fa48e07003e915111db470e7e557369cb0e779aff2f275", + "tests/test_auth_controller.cjs": "ad08a05093dd6a3c96915c265257ecf00dee4575d86c9de796b62bbcb65c6f26", + "tests/test_auth_helpers.cjs": "6e7b9110a84231e4ab34bcfca421e722c15005fa9c7bf51626a72c13dca1a25e", + "tests/test_browser_page_load.cjs": "d062d47a7e7e608a2e97eda018a70ea8edb30e12a5afad2ea951f81ad9d8119d", + "tests/test_browser_startup.cjs": "7d2be37ce682f593407a890013b25268fc595f8cb80c42dd6edc9e2e97373e52", + "tests/test_bulk_import.py": "6c085c2a11bcd52e3a39a1c74a2fc84088160f970c22a99dea9eeec4c27a2d4b", + "tests/test_bulk_import_controller.cjs": "ce193a2f3c6f257d8a3466ae3c8505b3e49b366d4d2ff448899ccbfa4f1b9d52", + "tests/test_caption_exports.py": "170207224c2b2393b701058ff46f73f13f3c6be6d623e451e89f0c3b1e25c40f", + "tests/test_caption_import.py": "83d46023931d671035959dbdc45b1117f4c82b0d4abb110c35cd28274bf28fbf", + "tests/test_caption_import_controller.cjs": "1a5b7ce0beb56c05b68d33c2b65354d24b8de74bdee44e09a3d749a835a0db3a", + "tests/test_caption_proposals.py": "b199041df42538ab7bf15d15700a1639bef49104c33505fad3584db78dbd128e", + "tests/test_caption_proposals_controller.cjs": "f9385428a190f8bfb9e8bfa9b155011d46cda2228b6e35c5524bf28524fb6042", + "tests/test_caption_reload_controller.cjs": "a6c21de93424eece37e5a47d38a5f3c49328d965c48954cc0da6f65f3916eaa8", + "tests/test_combined_workbench.py": "a6ff63d3dc3bb0ee02d2d94f390f4eff052008e2ecb08929e5be2d65b0921404", + "tests/test_combined_workbench_controller.cjs": "cb323e44713dff35ddbf291f20ef5bbd4054194634c6a73dcadf79b9a7a0a7b8", + "tests/test_cpu_recipe_contract.py": "1a45b1e6f4f58d3a2002686aed4f04afc7f8736cd618641769bb5e6f8c762ec5", + "tests/test_curation.py": "d0d592e869fe6ce4dd923ad5e6df7ba0f4357d337a4584419fd1206c0c21f144", + "tests/test_curation_controller.cjs": "e60b14423fc485fae0f3e12cb217cb0df7501882f985ab791ce91ca50de44cee", + "tests/test_dataset.py": "0938fcc8819dd0aaf4b400e8a715027a8d184c4dbe3f5789cc701ad1177383e4", + "tests/test_dataset_releases.py": "32ee71ced83f17717980c1eb4375611b2483dbef9937c3e9b43a80817168e550", + "tests/test_execution_approvals.py": "8368601c1cdb90504533e7f88a515101e7362ac780380224fac8a925c936bb2b", + "tests/test_export_runs.py": "926d86a6331f90f61f846ca421aee0e6ebab650667788fa0c4ec2195c659d401", + "tests/test_external_artifacts.py": "54373e580b3c806515d6bab29387614a226104113fecc782edc0b601c65a3a44", + "tests/test_external_http.py": "dff9afebade39bc530575f19defbe6064ac39b5406a9e461fca7f1af6cf6e72c", + "tests/test_external_progress.py": "1dd5a8a194fcdb182f7d22595160e1bf6eb97749a3bb90da79d0f1d9a05077f0", + "tests/test_external_runs.py": "59931dd73ebe7531e793a6dbe5ac4f9f9d5a6c8d6eb2df83930611d7e99118a4", + "tests/test_frozen_recipe_inputs.py": "2257212c8a2719862dc13f8c4ba86bce6e0a927c69a77da183802b248b85a44d", + "tests/test_gateway_discovery.py": "f67eaab50db54e1abac9bfadb51b1bfc807f43c8286dd8ebc4e1126f8f84edc9", + "tests/test_generation_job_api.py": "bcb9c18eec21034eb1079c2a222e7a0d2ab447de2c2392833baac3902713151c", + "tests/test_grounded_candidates.py": "eacfca315f4d1046a3e23b5fc12213c8e75167a56d4cf58acd95a5224d0c2a5f", + "tests/test_image_classification_export.py": "f1a93a4c638a563cd481668b80d05ed48b0a57e58f021cccf8c3ded5c3d06e44", + "tests/test_image_classification_export_controller.cjs": "c21a1d9b64116396dc4e007b7f07b81d28a1151ba548e415bfd45274effc12a4", + "tests/test_image_generation.py": "2c4dc04957f25497c7b84cf4870efeba85f171aabbbc9c798ead0ee36c554e7f", + "tests/test_image_training.py": "1a1dcb3bf330ab3b9790cfbccbddebc5444e2c8703403cc40b5e3e81e882b01d", + "tests/test_instruction_responses.py": "f6754faa43b35b43839ac968acd7c05a2197576ff4e355e237e783a992ba0d7d", + "tests/test_instruction_responses_controller.cjs": "bcc6df5ace74be696f4b9ca98e0475be65d76c9ceedfdbba8dcac443fae9d8f8", + "tests/test_large_recipe_contract.py": "de97172774e68031adc520b1917bf629f6906188421ae0840704c0833077eca3", + "tests/test_mcp_stdio.py": "8098c7a1485e7e31b2240dc6790b26e0eaaf481753087b0407fff0cd2b85b91a", + "tests/test_mesh_release.py": "cc57a6d4b58cd96551d25a46631945a45c7dc39a21a869e563068a021ec89c20", + "tests/test_mesh_runs.py": "f03b012c0fa7649fb25ab2464977980066fa886fb26fc417111e802dcab47267", + "tests/test_meshes.py": "d9d36438aba8cce733e4a7a67559ea45095b797311d53392089389d0b1de5d38", + "tests/test_meshes_controller.cjs": "a5137a40c573a2c0a73740ebb1133c5fb263030bbc8077a8bae14b2ca496d242", + "tests/test_metadata_filters.py": "fef2682f8c6a2e7d1ed58dc08fba8d653edd98a76578d7cc012841a959b25631", + "tests/test_metadata_migration.py": "9de22c42dddf41066586bbde1c6852ad09bdb1730a3ce9a25826658924046e9c", + "tests/test_metadata_transactions.py": "14d9155639c6d613c75be318effe7413be14998c848c455cd92c87d266623c4c", + "tests/test_metadata_workers.py": "fd9b624410ad3d32aea5bc77b3739a9aa8207f6d9a0da3bec27b0f54d72462c5", + "tests/test_native_detection_import.py": "2eb4e8ab069bf2636ce9cfb17c2ed7286d82349324f8a073037906aa9c59a751", + "tests/test_native_detection_import_controller.cjs": "4690e65d8a85cfd4492bd8136f218c482fc32562bebc198f515ee7057e3545a9", + "tests/test_native_detection_stack.py": "5e8e2e955f9b6ae0b0f702cd48fea922995bcfc296783df1abbe152836d69b25", + "tests/test_native_text_import.py": "86d347c27587214062a6cf7a0d1d8799d4422818117a6cc9e26b1bf90aff69d0", + "tests/test_native_text_import_controller.cjs": "98e550c365133b1954537114cab78dcec4ba03ba395e622c591f13f4ba8e2742", + "tests/test_pipeline.py": "bda005471eafc061482990a59d16ce91924bbf46e31b1a0f2a766e16be694bbc", + "tests/test_pointclouds.py": "4551a41de6f0d45bd123c8d640324613e698e1683c9a663fa0a47c07f1cefa9e", + "tests/test_preferences.py": "f3c6591965b9a14e4623940ad02696339452ddd0910ffdff4d617ce1b40e28dd", + "tests/test_preferences_controller.cjs": "24cb8f6f7d1cfb61089412eb6df5138a27faf6263130887fc69ad87626f99694", + "tests/test_projects.py": "29fa8a8a421a764a13605a087a6432b7671b01a5ba6511948beadf112b9b7d2e", + "tests/test_pumas_gateways.py": "c716d118e3e6ba0723f7751eb20b6c5cd496b3590f0e82d3341b150e9457621a", + "tests/test_pumas_gateways_controller.cjs": "96dc99ae0ce6cc6da6dece8288aad3595a323121a69bf2794091287a4c9145c5", + "tests/test_pumas_typed.py": "9b53bd8792b1b2330bc326f626cc3f91e050a7d9687c512018c35c110b2d5edf", + "tests/test_pumas_typed_controller.cjs": "7c53d8407fdc0bfd540292f937bfb71bf5cb3be96e5b4aecca22ed1ddc84df63", + "tests/test_pumas_vision.py": "0bc9d1d055ab60167fbf808cfa83e63b7a9e59694dd51bc00602218632bc54d4", + "tests/test_qa_artifacts.cjs": "1fc4c29daf0ea6603ff858fe3eca865eee428800b709bfbee9603ad3234ec376", + "tests/test_qa_qualification.py": "539abd5c349b2fd899cab9dd4b64d618d9e0012eaf2f06a5bdb2e8bec795f599", + "tests/test_real_import_foundation.py": "92c10da87b4c0a6593ff0546f9a89656ad2516b590e1a5cde903785a46731b12", + "tests/test_recipe_contract.py": "5eadd7cab5ddeb808d58c125647e4aeb34ae1030c0bbca2110a1d319d946b6bb", + "tests/test_recipe_process.py": "eccc63d300a487984f1fb253130c52a79312feb7db7c8429a13703792735c0e3", + "tests/test_release_preview.py": "ee8f1f2701c4cddc7d0c7fdd211894428620f0415d8caf0bbdc931a7e7936f79", + "tests/test_rheon_adapter.py": "ba5eec5328528598fac13ac7d96030a7e9b7290371cc54d6b05a76ffc69af56e", + "tests/test_rheon_cpu_adapter.py": "5e278f8d0060b9d1009ac89650a7f7ce635adb9cdae5a82960f1d3360a79b1f7", + "tests/test_rheon_cpu_training.py": "d520bb23a2b24561e9ae91664e6b37ceed3d61d7265d59aa922b9b92b46e2aba", + "tests/test_rheon_evaluation.py": "0469b965073a3c71f6637e0ef7e17158fb494fa43fe44b1a45ae59c291e97d53", + "tests/test_rights_note.py": "fbffc75b8651f739e1b98989e7c8e4708260580a73471a70d7d1b15e00b857b6", + "tests/test_rights_note_artifacts.cjs": "8922f55d613f9b63e37ea53670acebe6efea7fc4923a53410ae2a8a065b13ddd", + "tests/test_rights_note_controller.cjs": "7f9f3a50684b8270101e3341171ac46d2b08c9efea8867ed41865223ef1e93a6", + "tests/test_run_recipe_inputs.py": "5906e4f48bb038e0a03821e3be845ecca36bbe688bd67158116f8ddd1e6f9ca3", + "tests/test_run_scientific_import.py": "38619c38d6935c2b78f30eab477fa7083fbeeba5ff60676535d438ed99527cb9", + "tests/test_runs.py": "15e0342e5f7b146c6cb70a28816756b9e1348b0ab152440ae32882c67e4eb501", + "tests/test_runtime_snapshots.py": "4a932759b55d641a6aeb329430b43460c0f1afea3a4d3cd2a3f1c3051ab376d0", + "tests/test_saved_generation.py": "546ea3db08c0d772a3616f4dc00757b2cd0c6c14ad056f5783527d391a122a5a", + "tests/test_saved_searches.py": "fc3f5b0a12835be2fa629e1622ab1413bdbae7cf7c3632caf7a5225fdb277300", + "tests/test_saved_searches_controller.cjs": "918baa9325b91ca5e23c3b20366a10e6f206827e7386d5422d08b2b72dc44b55", + "tests/test_saved_selection_intent.cjs": "bfad6b7ea3e094e64a5ad0cc39fa7a17073e17bc32cb898fea1022be8b36ccb9", + "tests/test_saved_selections.py": "560a1fcb6766abfa706dc642c73b8d91fb171a3e007e49604163f281f906dc8a", + "tests/test_saved_selections_controller.cjs": "5d04684415739d4b42dce8663bfbfbf38308330160d196fa073aa91d0c18cd26", + "tests/test_scientific_fields.py": "868b4294fe3aaa258796a562eed44b49e49f29585e05107e9e2ce7a21b908154", + "tests/test_scientific_release.py": "1976d3708e04503f8a94e9f2918487dfc4c9c961849efe48fc8171a9a2db4d95", + "tests/test_sequence_batch.py": "c8be7c857d37ca11d8e52878115eea5c93a21e7baa50ec2261c1a1fc1a6b7054", + "tests/test_sequence_batch_controller.cjs": "d487f8d51d7835e2abcc92441d8aa24a3fa35090daced0d85e40be9993f11d34", + "tests/test_sequence_release.py": "a7457466674f48bb08cde5237b80d5ca770128b22f5f359ecd4bc90d12d30819", + "tests/test_sequence_runs.py": "09b9861d05f0a5dc0b9da2390f1eff63dba25662ae599fd0ae59e7b7fddbf53a", + "tests/test_sequence_v2_runs.py": "c0a01076f9869f366bd9de96f6b8e338a747d8abc5a1867ab6cdab88869f6e5e", + "tests/test_sequences.py": "0e305b0eeb718893e857a355998345137fe043c5cbce46b29b91046e91d15688", + "tests/test_sequences_controller.cjs": "47180b1e6b0cdc2b4182ecac4c962d196d6545840abec0b3f98970fcf4e08807", + "tests/test_sequences_v2.py": "ebf96c2cf91e7e05e780f5d46f53f0eb98fc13cc197af818628ec8cd34958f40", + "tests/test_spatial_controllers.cjs": "15eba02632ddd3ab17ea6a6288bf0bd70347093955aaae678877f6a11bb82c59", + "tests/test_spatial_release.py": "823cd95654cfa8be17f07b6e6c84fe00b03024beee81f8ca9f5a3cbfa051f49d", + "tests/test_spatial_runs.py": "59d1c53542e15cfeb78922be8e366aaec2db541a7a1cbb69710ade249951a99b", + "tests/test_spatial_storage.py": "dc9e0588b73b5fc03b296d1382c4e131571dd1b261c2424f4beff15b0ddaccb0", + "tests/test_synthetic.py": "7d077c66a532efd57ea29347641f7962b4687baa664b5d339a0ed2b1223fcd52", + "tests/test_text_classification_proposals.py": "7ecf4870d58e915dbcf74546e531ad28939eb837170401e88f07346ae4de51b3", + "tests/test_text_classification_proposals_controller.cjs": "00bcaa0f32754e6c7af542500ddbbd6ce39a2c2679a0d989a6a354e06c323d7d", + "tests/test_text_corpus_export.py": "c8f840ec9263c9e8f70b0e93da9632d1d1258b0690718ded9b3685ed9a3145c7", + "tests/test_text_corpus_export_controller.cjs": "dbe4401c84d9a759bc3991ca5a91bef6e673806276799a64a0d92d53f3d6c826", + "tests/test_text_training.py": "94481a278c29a056018fa27585ca712ea38ba7ba57663628ae4be10022ee374b", + "tests/test_volume_assets.py": "11519cefc7c0bffba7f878336465f2e16b5b70b65cd480f5326bb06afa4acbfd", + "tests/test_workbench.py": "97fd968831531fc750f564f3e23dc3b021662a4d955939e82f5048dd87c69ef5", + "tests/test_workbench_controller.cjs": "17dfb3ae38c9143e41ce0242a3b06e5a6f32d65e62f47c6f364de6619ca2e1bd", + "tests/test_workspace_contracts.py": "b281d64940892b0408702b0b6fa1346daec018fcbfbb5b75ef955158bd8b6f41", + "tests/test_workspace_external_controller.cjs": "4f8c942c9cab5a9a1fd5fd3a965e5cfe0df88d6bb07f66434a724a6577a8e111", + "tests/test_workspace_metadata.py": "3bc9a6823935329588d0eee7d2ddf6960ff4bd4d12df9cd736d19badb2cd4ac5", + "tests/test_workspace_offline.py": "03a277e830dd8c5a2947d2158276b9207b675ae7c75f2562f3e6172acd93eb4b", + "tests/test_workspace_service.cjs": "6d6d61ceec55f7f57640d382b97a80b8a85ba756c7aab0ec52eb13d3e8944b84", + "text_classification_export.py": "2510ad278a95892d4453ffb5b146ae47c11f8e31f3dc4cf9fb005eec79270bdf", + "text_classification_proposals.py": "6a29dfe752be4ae2c69d7b2e4ca3e68e87dc511cfee2429093748b4ccc56c86d", + "text_corpus_export.py": "3af4883df1b714519fb4e9be872f39de20dc3013deca720e32a89789cbdbff69", + "text_training.py": "9794c343af00854519be0873bad766eadf681c4826be010efb3423cae1d0974e", + "upgrade_metadata.py": "df798ada0b929fd329c42add8545109422b5821874aeb4c913c4ef5290015525", + "volume_assets.py": "1e057fcec996969e0a9b44ae7561fb7b6ea95b6201a23617fdbbc3a046b610c1", + "workbench.py": "e2735b9242040b471f67ff3663316397a58fba19338cc79058796106e7ef5562" + }, + "results": [ + { + "label": "base_agent_api", + "command": [ + "/workspace/Tuldok/.venv/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_agent_api.py", + "-v" + ], + "log": "/tmp/tuldok-p6-final-base_agent_api.log", + "exit_code": 0, + "elapsed_seconds": 0.16463745899818605, + "log_sha256": "1fb5a727aa2d7ff21cd30deda6f6f3698e07b67803710d5b0632ad1ccef5f578", + "tests": 16, + "unittest_seconds": 0.042, + "skipped": 14 + }, + { + "label": "sdk_agent_api", + "command": [ + "/workspace/Tuldok-p6/.venv-agent/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_agent_api.py", + "-v" + ], + "log": "/tmp/tuldok-p6-final-sdk_agent_api.log", + "exit_code": 0, + "elapsed_seconds": 15.489625693000562, + "log_sha256": "7a3d7173c544f3b1f5cc864c1d7dcc037b13a7e90ecbf038e7c5475945edab9c", + "tests": 16, + "unittest_seconds": 15.356, + "skipped": 0 + }, + { + "label": "native_pointcloud", + "command": [ + "/workspace/Tuldok/.venv-training/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_pointclouds.py" + ], + "log": "/tmp/tuldok-p6-final-native_pointcloud.log", + "exit_code": 0, + "elapsed_seconds": 0.5082779959993786, + "log_sha256": "2c91dd4308073a8d3452dcc3ba6b5059d8738a6f2ac0109f7974fe3392f38b5a", + "tests": 11, + "unittest_seconds": 0.405, + "skipped": 0 + }, + { + "label": "native_volume", + "command": [ + "/workspace/Tuldok/.venv-training/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_volume_assets.py" + ], + "log": "/tmp/tuldok-p6-final-native_volume.log", + "exit_code": 0, + "elapsed_seconds": 0.17756779000046663, + "log_sha256": "f2b7cdf24bb38094da8d1374d60e290ad23eb5733cbf544eb7e390233f1417cc", + "tests": 9, + "unittest_seconds": 0.073, + "skipped": 0 + }, + { + "label": "training", + "command": [ + "/workspace/Tuldok/.venv-training/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_rheon_cpu_training.py" + ], + "log": "/tmp/tuldok-p6-final-training.log", + "exit_code": 0, + "elapsed_seconds": 2.535587405000115, + "log_sha256": "6167bbb92844a9ead3f80d20af40a482ef436867fa28d9444a94753164a7cc7c", + "tests": 12, + "unittest_seconds": 2.393, + "skipped": 0 + }, + { + "label": "evaluation", + "command": [ + "/workspace/Tuldok/.venv-training/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_rheon_evaluation.py" + ], + "log": "/tmp/tuldok-p6-final-evaluation.log", + "exit_code": 0, + "elapsed_seconds": 0.3181099089997588, + "log_sha256": "e42af03064ecd909ce5fa42087a0790f5fa8b137eb21e824c3e29863617ff4ce", + "tests": 9, + "unittest_seconds": 0.173, + "skipped": 0 + }, + { + "label": "sdk_agent", + "command": [ + "/workspace/Tuldok-p6/.venv-agent/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_agent_*.py" + ], + "log": "/tmp/tuldok-p6-final-sdk_agent.log", + "exit_code": 0, + "elapsed_seconds": 46.90779315099644, + "log_sha256": "1f08341c0fdaa6c831d4571ad859d889d05a102f1d9f3fc025e5d3f68513d5c2", + "tests": 22, + "unittest_seconds": 46.42, + "skipped": 0 + }, + { + "label": "sdk_mcp", + "command": [ + "/workspace/Tuldok-p6/.venv-agent/bin/python", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_mcp_stdio.py" + ], + "log": "/tmp/tuldok-p6-final-sdk_mcp.log", + "exit_code": 0, + "elapsed_seconds": 8.190091664000647, + "log_sha256": "67a9895a3371bca6ae92012ac89a98b09f95a8dd726f4e2312364a50d4d6897c", + "tests": 13, + "unittest_seconds": 8.047, + "skipped": 0 + }, + { + "label": "javascript_01", + "command": "node --check static/auth.js", + "log": "/tmp/tuldok-p6-final-javascript_01.log", + "exit_code": 0, + "elapsed_seconds": 0.029270248996908776, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_02", + "command": "node tests/test_auth_helpers.cjs", + "log": "/tmp/tuldok-p6-final-javascript_02.log", + "exit_code": 0, + "elapsed_seconds": 0.062184472000808455, + "log_sha256": "8b466d109d3156fff0d7ee8c8a99c0560b8e2dd5f9701be920bc916259b6c3d6" + }, + { + "label": "javascript_03", + "command": "node tests/test_auth_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_03.log", + "exit_code": 0, + "elapsed_seconds": 0.055927985995367635, + "log_sha256": "72d7685e76922bde0cf38c2f87e25d1c2fb69e4f179fbc4b3295c561cafd55a0" + }, + { + "label": "javascript_04", + "command": "node --check static/scientific-fields.js", + "log": "/tmp/tuldok-p6-final-javascript_04.log", + "exit_code": 0, + "elapsed_seconds": 0.027434620998974424, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_05", + "command": "node --check static/workspace-external.js", + "log": "/tmp/tuldok-p6-final-javascript_05.log", + "exit_code": 0, + "elapsed_seconds": 0.03158872500353027, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_06", + "command": "node tests/test_workspace_external_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_06.log", + "exit_code": 0, + "elapsed_seconds": 0.060678513000311796, + "log_sha256": "2fc07becd798d6fdb39214390903dd655447888e30e80fbbea59c5ed6911192c" + }, + { + "label": "javascript_07", + "command": "node --check static/workspace-projects.js", + "log": "/tmp/tuldok-p6-final-javascript_07.log", + "exit_code": 0, + "elapsed_seconds": 0.02719331200205488, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_08", + "command": "node --check static/workbench.js", + "log": "/tmp/tuldok-p6-final-javascript_08.log", + "exit_code": 0, + "elapsed_seconds": 0.030113838001852855, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_09", + "command": "node --check static/audio-editor.js", + "log": "/tmp/tuldok-p6-final-javascript_09.log", + "exit_code": 0, + "elapsed_seconds": 0.030035777999728452, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_10", + "command": "node --check static/saved-selections.js", + "log": "/tmp/tuldok-p6-final-javascript_10.log", + "exit_code": 0, + "elapsed_seconds": 0.030640381999546662, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_11", + "command": "node --check static/saved-searches.js", + "log": "/tmp/tuldok-p6-final-javascript_11.log", + "exit_code": 0, + "elapsed_seconds": 0.027321679001033772, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_12", + "command": "node tests/test_saved_searches_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_12.log", + "exit_code": 0, + "elapsed_seconds": 0.04587422600161517, + "log_sha256": "290e6f79dd9894dcf08d37cd4ce5a3dea8792d502f4f961697c5f73d0b89d0e9" + }, + { + "label": "javascript_13", + "command": "node --check static/curation.js", + "log": "/tmp/tuldok-p6-final-javascript_13.log", + "exit_code": 0, + "elapsed_seconds": 0.027839550995850004, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_14", + "command": "node --check static/bulk_import.js", + "log": "/tmp/tuldok-p6-final-javascript_14.log", + "exit_code": 0, + "elapsed_seconds": 0.025795576999371406, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_15", + "command": "node --check static/caption_import.js", + "log": "/tmp/tuldok-p6-final-javascript_15.log", + "exit_code": 0, + "elapsed_seconds": 0.027094860997749493, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_16", + "command": "node --check static/rights-note.js", + "log": "/tmp/tuldok-p6-final-javascript_16.log", + "exit_code": 0, + "elapsed_seconds": 0.023999051001737826, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_17", + "command": "node --check static/preferences.js", + "log": "/tmp/tuldok-p6-final-javascript_17.log", + "exit_code": 0, + "elapsed_seconds": 0.0231427580001764, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_18", + "command": "node --check static/instruction-responses.js", + "log": "/tmp/tuldok-p6-final-javascript_18.log", + "exit_code": 0, + "elapsed_seconds": 0.0243033180013299, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_19", + "command": "node --check static/native_detection_import.js", + "log": "/tmp/tuldok-p6-final-javascript_19.log", + "exit_code": 0, + "elapsed_seconds": 0.02341931999399094, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_20", + "command": "node tests/test_native_detection_import_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_20.log", + "exit_code": 0, + "elapsed_seconds": 0.1988620509946486, + "log_sha256": "4f7c64b7ec91192b9fd96ad2210d5bb8d2825857cdf759b10982f5873b2cd12b" + }, + { + "label": "javascript_21", + "command": "node --check static/native_text_import.js", + "log": "/tmp/tuldok-p6-final-javascript_21.log", + "exit_code": 0, + "elapsed_seconds": 0.023524693999206647, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_22", + "command": "node --check static/caption-proposals.js", + "log": "/tmp/tuldok-p6-final-javascript_22.log", + "exit_code": 0, + "elapsed_seconds": 0.024026752005738672, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_23", + "command": "node --check static/text-classification-proposals.js", + "log": "/tmp/tuldok-p6-final-javascript_23.log", + "exit_code": 0, + "elapsed_seconds": 0.024242628998763394, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_24", + "command": "node --check static/pumas-typed.js", + "log": "/tmp/tuldok-p6-final-javascript_24.log", + "exit_code": 0, + "elapsed_seconds": 0.027555859000131022, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_25", + "command": "node tests/test_pumas_typed_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_25.log", + "exit_code": 0, + "elapsed_seconds": 0.02975480999884894, + "log_sha256": "55a9906628629ce1e60793eccc6085a3cd06566539d1dc78cb755de5730bcad1" + }, + { + "label": "javascript_26", + "command": "PUMAS_TYPED_PREFIX=caption-proposal node tests/test_pumas_typed_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_26.log", + "exit_code": 0, + "elapsed_seconds": 0.028800927997508552, + "log_sha256": "55a9906628629ce1e60793eccc6085a3cd06566539d1dc78cb755de5730bcad1" + }, + { + "label": "javascript_27", + "command": "node --check static/pumas-gateways.js", + "log": "/tmp/tuldok-p6-final-javascript_27.log", + "exit_code": 0, + "elapsed_seconds": 0.023514088003139477, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_28", + "command": "node tests/test_pumas_gateways_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_28.log", + "exit_code": 0, + "elapsed_seconds": 0.030372539004019927, + "log_sha256": "4392d469439f52450d9b8086138f308b87e00bc84a06e16dbb0ad8611925ff35" + }, + { + "label": "javascript_29", + "command": "node --check static/pointclouds.js", + "log": "/tmp/tuldok-p6-final-javascript_29.log", + "exit_code": 0, + "elapsed_seconds": 0.02693400499993004, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_30", + "command": "node --check static/volume-editor.js", + "log": "/tmp/tuldok-p6-final-javascript_30.log", + "exit_code": 0, + "elapsed_seconds": 0.02301177999470383, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_31", + "command": "node tests/test_spatial_controllers.cjs", + "log": "/tmp/tuldok-p6-final-javascript_31.log", + "exit_code": 0, + "elapsed_seconds": 0.027843670999573078, + "log_sha256": "1bb313c8356173ff2645383b2d38d0be8cedc6ebef358f9e24ac0c282923ccc9" + }, + { + "label": "javascript_32", + "command": "node --check static/meshes.js", + "log": "/tmp/tuldok-p6-final-javascript_32.log", + "exit_code": 0, + "elapsed_seconds": 0.023144965998653788, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_33", + "command": "node tests/test_meshes_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_33.log", + "exit_code": 0, + "elapsed_seconds": 0.036091072994167916, + "log_sha256": "1bbe9d3a898cee3fb88d7e62338e0bfe89f4b77aa23ae14002962d62cfd30a31" + }, + { + "label": "javascript_34", + "command": "node --check static/sequences.js", + "log": "/tmp/tuldok-p6-final-javascript_34.log", + "exit_code": 0, + "elapsed_seconds": 0.025840037000307348, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_35", + "command": "node --check static/sequence-batch.js", + "log": "/tmp/tuldok-p6-final-javascript_35.log", + "exit_code": 0, + "elapsed_seconds": 0.024408461998973507, + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "javascript_36", + "command": "node tests/test_sequences_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_36.log", + "exit_code": 0, + "elapsed_seconds": 0.033456329998443834, + "log_sha256": "692426dfa0933e2fbe56ccfa41c789b70679313dc53d0d36be42004c697b5445" + }, + { + "label": "javascript_37", + "command": "node tests/test_sequence_batch_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_37.log", + "exit_code": 0, + "elapsed_seconds": 0.14130300700344378, + "log_sha256": "7d6642f51391e8e54e35e7c9825c4f910003ec93f86588fd22b8f08c91383788" + }, + { + "label": "javascript_38", + "command": "node tests/test_curation_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_38.log", + "exit_code": 0, + "elapsed_seconds": 0.03892550199816469, + "log_sha256": "e4005173e9a16864039a1959b1f544aae2e6b9942ddc442eb05488bbf1819f40" + }, + { + "label": "javascript_39", + "command": "node tests/test_browser_page_load.cjs", + "log": "/tmp/tuldok-p6-final-javascript_39.log", + "exit_code": 0, + "elapsed_seconds": 0.032262780994642526, + "log_sha256": "261c7df53bd1fee0a3f2ee3763a0495c63ff38894292ffb5edaefc9533d2d420" + }, + { + "label": "javascript_40", + "command": "node tests/test_qa_artifacts.cjs", + "log": "/tmp/tuldok-p6-final-javascript_40.log", + "exit_code": 0, + "elapsed_seconds": 3.207200101001945, + "log_sha256": "2068b7efd1ea4aeca7072f9430b62b456ed05659a41ec51b721a3dad39b07cbb" + }, + { + "label": "javascript_41", + "command": "node tests/test_workbench_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_41.log", + "exit_code": 0, + "elapsed_seconds": 0.04232794899871806, + "log_sha256": "5857758e5789e3015458802d7e17c72a56d1ee5d3d09a2534ba3b9ce4fb07114" + }, + { + "label": "javascript_42", + "command": "node tests/test_image_classification_export_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_42.log", + "exit_code": 0, + "elapsed_seconds": 0.03380269999615848, + "log_sha256": "1f920f6736cde222dc2688ad1434d538d04d45d8154b74df01cbecc5044a868f" + }, + { + "label": "javascript_43", + "command": "node tests/test_text_corpus_export_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_43.log", + "exit_code": 0, + "elapsed_seconds": 0.04057856799772708, + "log_sha256": "88e80f2847ee1b9febb4b346f5489c79c47b7d5be6a78b08a990808a2fccae0c" + }, + { + "label": "javascript_44", + "command": "node tests/test_saved_selections_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_44.log", + "exit_code": 0, + "elapsed_seconds": 0.0339657289950992, + "log_sha256": "fd916ba6abe3f865e1c320fe149cc2f91185a4d57551976f3b2292cc4fbea0e6" + }, + { + "label": "javascript_45", + "command": "node tests/test_saved_selection_intent.cjs", + "log": "/tmp/tuldok-p6-final-javascript_45.log", + "exit_code": 0, + "elapsed_seconds": 0.07042049700248754, + "log_sha256": "3dd0a5384055d747a2a8b0fcf331efd7684ce504e84a175debd29446cb38dac7" + }, + { + "label": "javascript_46", + "command": "node tests/test_bulk_import_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_46.log", + "exit_code": 0, + "elapsed_seconds": 0.08762079500593245, + "log_sha256": "3e0563561164771d1543857525d2510a6c270ebb51103dcf2e4363e01aa0ccbf" + }, + { + "label": "javascript_47", + "command": "node tests/test_caption_import_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_47.log", + "exit_code": 0, + "elapsed_seconds": 0.14042672300274717, + "log_sha256": "d3172e0c94b24ca478ec65772d7272ad58fc05f735a87ab5689c267b9b5ad0b6" + }, + { + "label": "javascript_48", + "command": "node tests/test_rights_note_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_48.log", + "exit_code": 0, + "elapsed_seconds": 0.15353223999409238, + "log_sha256": "61b9242683445804ee8187e17ae26b78ca0280c5fd3c1362c9fa9fb7f8914601" + }, + { + "label": "javascript_49", + "command": "node tests/test_preferences_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_49.log", + "exit_code": 0, + "elapsed_seconds": 0.04681356599758146, + "log_sha256": "4ec807b9169b5ac58bce2ed41b2bed646baf1603cd1d52bda6c7450c4e560057" + }, + { + "label": "javascript_50", + "command": "node tests/test_instruction_responses_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_50.log", + "exit_code": 0, + "elapsed_seconds": 0.03815039899927797, + "log_sha256": "80f3568861ba8b2dae7e36ef4a886737f3291dbaa52415c74dc5b1dea91764e3" + }, + { + "label": "javascript_51", + "command": "node tests/test_browser_startup.cjs", + "log": "/tmp/tuldok-p6-final-javascript_51.log", + "exit_code": 0, + "elapsed_seconds": 21.135589808000077, + "log_sha256": "c8c6fafb8f5e56f48eda8ec7f8abc5c3ff2b73d39f576c7d0a35f9d208d62b37" + }, + { + "label": "javascript_52", + "command": "node tests/test_native_text_import_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_52.log", + "exit_code": 0, + "elapsed_seconds": 0.15837681000266457, + "log_sha256": "6ead1728855903672b5ad0d8b9ad83b2a4c4cf6ec4a65cee3cac1ef287d1e5a7" + }, + { + "label": "javascript_53", + "command": "node tests/test_combined_workbench_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_53.log", + "exit_code": 0, + "elapsed_seconds": 0.05357271399407182, + "log_sha256": "05868be49e9721d25e78625696969f1d8c5cdca61800a801ec01b13286fccb05" + }, + { + "label": "javascript_54", + "command": "node tests/test_caption_proposals_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_54.log", + "exit_code": 0, + "elapsed_seconds": 0.3462786439995398, + "log_sha256": "602504e3944e619be7bf9a0a7c0d4af57840234d0b6da7ccc5971bc9f5334f62" + }, + { + "label": "javascript_55", + "command": "node tests/test_text_classification_proposals_controller.cjs", + "log": "/tmp/tuldok-p6-final-javascript_55.log", + "exit_code": 0, + "elapsed_seconds": 0.483170417996007, + "log_sha256": "145594dabe5dd06e85d2366784941bfbe6f6c8f925f4d8428509a556c1a94535" + }, + { + "label": "javascript_56", + "command": "node tests/test_rights_note_artifacts.cjs", + "log": "/tmp/tuldok-p6-final-javascript_56.log", + "exit_code": 0, + "elapsed_seconds": 23.443906225998944, + "log_sha256": "d7a038989c1e40ab114ea5165e587fd271dd28339b2fb2ca6a686147bc460e32" + } + ], + "after": { + "access.py": "50681dd5b2aaba01a311a7465b15161ca264fa4ca9812b95f15914adb5d808f4", + "adapters/rheon/cpu_compare.py": "e2e14eb6f354b88a0123bcdd710d4f990102efb97f7cdb584db4700e7f05ab97", + "adapters/rheon/cpu_project.py": "fe22a72b6dfc1b703c5407ba5691cef2117f6d5adeddf0d504f5c94270c003cf", + "adapters/rheon/cpu_train.py": "ea3c9524f5b1ec32e261865c1f24e06a2ff03ad97d1ba040ae7e69c48de39238", + "adapters/rheon/cpu_training_project.py": "484fc46f4c81002a213a9e39c50ca0f43bf60c7c0c030376ac5e81deab2080e1", + "adapters/rheon/evaluate.py": "ba212546b6bbe404ed88913647a8454c0f7413558e02e638aad7096eba4b2798", + "adapters/rheon/evaluation_project.py": "2409e7cd9ee3768b6f01dba03e03fdc6383b294357c276d07c0dbb1009f2aff3", + "adapters/rheon/generate.py": "c50277e7121de8153e8056e83e67b20aa610c335eabccd2b229ae475313f0d9c", + "adapters/rheon/native_transport.py": "4155a3467052b291cea0bd8a9018122796851c0fc8499d8866cca28a2fdf821c", + "adapters/rheon/project.py": "cb68c41ec431078a5cd6be1615176867bb386afc25eb247f4888958b0ed73ca7", + "agent_api.py": "951e9540d31c8a4f4e8646dcbcb85dcd32460647f3e7d28d353224f5af1c6c7b", + "ai.py": "a3b04a3015496ff3c66c3eb450ccf887bd5726229669ac0515d95a2761ad3a9a", + "ai_codex.py": "debd26342e73a87635d772e3ee59d30bb822877008d667b47997f52e22f94f16", + "ai_http.py": "73ca648fe00e8f5a4022b14b72c80dd695228706a0f2b79aee605a524b8f2585", + "ai_openrouter.py": "70930124fac7ef08941f571c1d4492f72b29aa94807cfd5d66bc32555432b160", + "app.py": "80a4164bac0dffec432f63d121921986f6d077a377692f5dba0346eba1dbb649", + "audio_assets.py": "d69bfa94037ea132be4adebba26c4389d58925a408f2fc27c6984a71fc8dc1cd", + "audio_classification_export.py": "0f0643470cfa3b015c2d56c0e8e1dc2ad4944bc825127b9131fbbdd36349052d", + "audio_export.py": "bc20d32089b3a004504c6cb072e18db9e285c9195db84679670fe460ef51cfc9", + "audio_training.py": "fd5a21f1bfbfbbd72f8ba5a3bcc88017e2b8c2f075a7a6506310a01156f771a7", + "backup_metadata.py": "15fced02dbc6da6b035b2ab7fbf5bd368ef862d0d03eb01561781d09fb921f0a", + "bulk_import.py": "b8f7c55947cb82689850716b5a8f6f95422efde2e87c4fa3c640af004b8a2fdb", + "canonical_release.py": "1f92e2d822602211475a5e7c13198388cc0a36aa36e0872f66d9fd353dcc2061", + "caption_import.py": "86496e5ccaa5dbbf32d9731e7acfb76cc5c0b6a147e333e9a53aa8e9629ca406", + "caption_proposals.py": "a74ca7993b6f3b7dc7fb867a871148f04c743c048a1e988ab517554a35ae901c", + "curation.py": "b25576749afd01f9e699133c5db7e6113f9a5f0ad8961dafc4084292896b0049", + "dataset_recipes.py": "78ae918228f15f9d5924985075cb96535b8953b4ad5faa821d0cacd0a50e3c88", + "dataset_releases.py": "cabba1d75aa42fe4988a5fabea590f397c8fb1d148af42174bb4a0ed77a065cf", + "frozen_classification.py": "a6a9fc244bcb7de7da5217fb36d5e73bb03ca1756c9c63770c23a78336606649", + "gateway_discovery.py": "8a02e2ef9038859c1accce9ea3e31ea489423f19799a279f4be6f9afd61297d0", + "grounded_candidates.py": "55bf111d7dfe951fea960f347ed4bfb498d15dcc604bf46fb1ae2505cc1354cc", + "image_classification_export.py": "995edefa24fc039505337fd8d2915e45d173c18a03af513d9f5d8eb234225b96", + "image_generation.py": "c3a62b3cf0bf1d6f6d453a63f7f2a7d08de63864d880959bd0eab237d9856858", + "image_training.py": "5a7807f8834f96bf17e1c020357fdb96a7eb1ac94b54a440db80559d9923f99c", + "immutable_assets.py": "672c08d949f964fcd8cebd9a888092ab0163f022542df337e02bcb17f3c477c8", + "mcp_stdio.py": "9c4144cbb50d1144b3989ef8d71ac47e5a57e595cdf94253a5611feea1671362", + "mesh_release.py": "09d29a60bc37826b906097debaf7eb8577a425d3d791ff5df8d3b03607b10de1", + "meshes.py": "abeca65f8a39af57352828169f90f767b6bc770fb5407fb3f18af53be8ff84e2", + "metadata.py": "42559a7efd599f637e6e289802fa7400d59b2915edcf64e3260952d59cd7b439", + "migrate_sqlite.py": "be1a79a1b6f5e2c8e4c99862043a5afcd4f30d6539388c1600908f4a4f3f92da", + "native_detection_import.py": "80466232bd51f58bca9a00ef68e278da087b012e7f1b3b1171e6e51db3b8c572", + "native_text_import.py": "3fc35bc1f04e056a588e8e05f3f7b41ff894c90dae6cee2f1baaf37a7098d167", + "pipeline.py": "cea1522505c72557c793464ecd89a86ddf2b7eef5ed4249a6d1004fe516e573d", + "pointclouds.py": "02d9eef31661dd5a9f0855f8e59d7b839b0ad1590f53a657123a5d9da789dd9a", + "preferences.py": "d6279b18375fa8695584a02cfe962b56e77cf4f3521c5e33cc4baf09f8e4dab7", + "projects.py": "d147c6bae61068f5517fd15e3512311459cd4de3d6edfdd9ea984783470d432d", + "pumas_gateway_descriptor.py": "b9c4259bda856fd19d1d82b3a2c000a74ab3979832248fd3f1f1d3d6309c0752", + "pumas_operations.py": "e8b8acee54a027633ae39f00a23b3d4845ae474d031690134cafb1c75bf73511", + "pumas_vision.py": "5659c7731b5011ff39a0a9b7c27712382983f16286540f47f6b1337941bbda7d", + "recipe_contract.py": "7cb44071fc1bd040d31350b996d43629fc91218c16bd9de2336712193de8e215", + "recipe_process.py": "9bf5de04bef27a86ad239e05d9d105985d966a2b114350c3c8e3a92053b1a999", + "release_validation.py": "a04e0f3c941256422b0c3a8c28665b6fba025df9d3cfa6cd5d5686e2bb8de95b", + "rheon_controls_contract.py": "25ec0f98f9b0ec576f30793cd24c1dd7b4e77fa7a6bfc6ed323271f829f982f4", + "rheon_controls_sequence_contract.py": "5c41f3a3c848940191d05d9b5b01a2a398b0d2a67f23c603ab8e918897bd3b55", + "rheon_sequence_contract.py": "063d17a3bbc92a27c26c0f5dd4588a9478091ebbf53ce0ccb818cee6a9393b98", + "rheon_sequences.py": "9e3013fb1b5f1baf3de73678a26f964bc2f802435e6fff26476f816847fd22a5", + "runs.py": "ac32ef18e55390a19267e703835730294972608006094e47eb4c22f21548da79", + "runtime_snapshots.py": "dad9e4ddf9c11c0e1f2d5b9a7afd6877e7be375fe02030c65b684bca2b0ef45e", + "saved_searches.py": "fcd4021fc20702568f1e44a165473aa752b9a9794a958ff31b33c42aba7114d5", + "saved_selections.py": "4e89ee272fc8a685ec76b3737879d6560661a73e03fca264c2057785905418a3", + "scientific_fields.py": "19b63cf1c65335b55a907c84312f0f9be70de1aa79522d96ec38d4862fa55338", + "scientific_release.py": "b419730e7cc00212632b3adcdf63997343b6fb9aecd07a6ad2cb6f5c1728fb60", + "sequence_assets.py": "3ac8361f5e24f6b2af93dbd9030bab864da7bddb32da975d937e852d89fff98d", + "sequence_batch_import.py": "3e7af45744ae7f8393059715dbf7012567d0bbb528c3682dd1b992141ae32b10", + "sequence_release.py": "3d1bac3c2d78d75e08337b0659e435fc81c32c7625d8244be4d41f2ecb9e831c", + "spatial_assets.py": "fdd3715025426024a4c8fa1704645d98940cab7e6002846b9e72a54352fe6ef8", + "spatial_release.py": "4d6ec06fceb72257a9d25da09ab24bcf13fc38f66ae50e8b39d5a5796f9b357c", + "static/app.js": "b82969e67e7a7792a11f239eff2fec959158e1dd78d08a84d68daedb93aad6bb", + "static/audio-editor.js": "d397bb98480077326b4c96035d891f1d8eb77cef8a04f3b2aef1eb34d5bbcf40", + "static/auth.js": "6a38fa7dabf57b2c99d293c6851a732af76a19193bea43f7d2a8b8460d71faec", + "static/bulk_import.js": "2d19443342dad5d083ad66e32f5b4877a825296f1a41d8996befd336cec7d367", + "static/caption-proposals.js": "09906d8ea799ee7def657a5d1c7746a5dcbe25797f7849c7ac27364089a083d7", + "static/caption_import.js": "280a116a086c3e8c69fcd17e24aba6630bb6c3d3c1e653a5ed84c184895ae850", + "static/curation.js": "2f51c2e063eddbe16cb92dfcaa96c35c749dd61960ebd92c8c538bf0c6ff389a", + "static/instruction-responses.js": "3fb4fb8d78154bedb37ef90afbcc269fdab0938c4ac50236f38a7f26f54ac940", + "static/meshes.js": "c2eb7622dd4e0a172db9db36e46a0ce66800d5b03aca989cd1f08dd40b8558c8", + "static/native_detection_import.js": "b07d3a9663d5b1534fca24dc7481caf4cb166bb4a83c4c97c2a78fb9c8d50d82", + "static/native_text_import.js": "1704549e9e5cf489e6351d5126858eb774ddd94d060e596a0bfba5fc00ea8773", + "static/pipeline-editor.js": "2272f1a9b106945203112a46d73643cc5d4dbbfd92f0d7c09d1cc36a713042d2", + "static/pointclouds.js": "34851447f34ea0204887b6aae4a86d73f6f94c8d1726b8e82b892027336c0c84", + "static/preferences.js": "fb22c04b6856d33b7e298aa1989d073c937ab40020025f39b86daaff62b948f7", + "static/pumas-gateways.js": "02df8f34362fc2e32f6a4582a9cb71adaa5d7b83ccd897803b9e1d02c7bcb932", + "static/pumas-typed.js": "50fd9fc961dafdd0c34cfcb1137d04f85a99f324f76fd5217f227b789c8835ad", + "static/rights-note.js": "fd09cef5c52b2635ad42998483c7054260140459444fbd948bb596e5966feb11", + "static/runs-view.js": "7568b843ad9b56c1c6878a9756553cdf8092dea3b954aec1947b8f32d730ca85", + "static/saved-searches.js": "49210b9da9dd7f7372e977c15543a77c5ada1df82ad9abdcb350026e16517892", + "static/saved-selections.js": "2c2feecca798217644247f98aab8e7a00d707a25d4af75e02f9d906ccbd905a3", + "static/scientific-fields.js": "96e6289ade2a634e9648cbe8aa899e5bfaddacddcea120835bda8cb6d65e14a6", + "static/sequence-batch.js": "36bbbdc07cc3a03856e6072e4141545c1c0f202805faedec76a2c7f20c0850f7", + "static/sequences.js": "0f0ce113a0e2e3e3160f063ed577f882fb7d53d156f517ed46920030f1c0d17e", + "static/text-classification-proposals.js": "03dbec1114700f383f8bc9883c8a4cdaae59d898fc44240022b2011893965d6f", + "static/volume-editor.js": "d48806cd446ea05586b524c24340d87abe8c69063ea6b15c254f76b3e51c5db8", + "static/workbench.js": "7e31b8a0e916f1627cb523d84c6d98c732eb739617b3f3856cbc1c235a6829b2", + "static/workspace-external.js": "e05d699a6f11273a3f7a2c15236c72ac947e559381142eed2b42fe473c90ebe0", + "static/workspace-projects.js": "4a5e2e4c61cea0cf9f3a30772cf5f47408c72a77d6fe2afe63a2717e83157b7a", + "static/workspace-real.js": "5ef1571fe03a0b234a1469d9031432287877fd0e15131ee3aedc04d7207d9a01", + "static/workspace-service.js": "9a924f671f604221de3c055a75da2fce3a82666d4090cf50477ab757032228bd", + "static/workspaces-data.js": "da2807d18da4ef4c366bb178d30b336d0b9896fd349b76dd97183e7237022dd7", + "static/workspaces.js": "33eeb0ed47e1f6d8b651edc473d44048d8d7b872d581c19960a023a0bd0fda25", + "synthetic.py": "dc55737b0f55ff4ec8df56a3d6b4f4596f5067bfd75672ba6326453047cab5e9", + "tests/auth_helpers.cjs": "363ae493c121f2cc5e804c3774d6ee4c2078ccc936db1c37ddf749cf9b4e1a15", + "tests/auth_helpers.py": "27a40542686a8a56df04601d765b0d4bf815d65d327b49931696a0ed161b5a7e", + "tests/browser.cjs": "c4c5ae4aaa227207258be2f7ebd68e4d4ff046dd14c170ce8d5f60203bb25208", + "tests/browser_access.cjs": "b19ba3559cc8321c3a4d932f0c14a08c3763ca41ac8640fd965d346f95213159", + "tests/browser_bulk_import.cjs": "a7c8fea60c9a08b808cb7f26ec94a83be2b20f72b2605a5fe81ec5ee1de919e3", + "tests/browser_caption_dataset_integration.cjs": "02e531b8c183c2a6f6cd1db88b24dfe686bf65cfb5236e85e67b337f9bcccddb", + "tests/browser_caption_import.cjs": "1fe190836b28bbbe75e4ad037ddc105ab8274e4b58c94976c0bf56f963fdae5c", + "tests/browser_caption_proposals.cjs": "1e41aa2e33f0caca0bc23ec447710f9694535c303fadb9717c188c8c0dd3c78a", + "tests/browser_caption_proposals_server.py": "b131aa4b8732ccd465b5b6c8ae9afc89365e4ae70375fdc0fb239df5e6bb7b06", + "tests/browser_captions.cjs": "de73a2a845e503aa2c402e7be826fbe8a2d2c2e97b6c87967036436943ff54cd", + "tests/browser_classification_preferences_integration.cjs": "876fc48921112ad014cc2b406756100680aaf73a6a622ca9e78fcf4715c67898", + "tests/browser_combined_workbench.cjs": "775809ee600a2df52cc691cf05c16bf895a98635be05ba859d4ebdf06b048631", + "tests/browser_curation.cjs": "e6de80c9dfda22bbb81be8935903705320c94c7a8395fd062d9bb908976f677c", + "tests/browser_curation_server.py": "812eb92ca91e0c14e6a02a753e1554e5c499b198d659c90036fd2ee7ebef80d5", + "tests/browser_dataset_integration.cjs": "8145f21e137397111241495c21a80a96ff7b3b758698afa9ff51a6f1b0615d4c", + "tests/browser_grounded.cjs": "47eedca6a53ecabffe35155d7f53c1bce7b73cb390d306860b65a108be558d8e", + "tests/browser_grounded_server.py": "afa77db2d8d4ce01e8257c5d3b5a35cd2dc78bf3199cc306b307341748b170ea", + "tests/browser_image_classification_export.cjs": "3315d2eebeceef30f4789e6b1c9995e82d789c171c6fc13e8401ce276966a4c8", + "tests/browser_image_classification_server.py": "f5f3c3512823298afd6ea110b74bd617ef814e6e0d29cd35cd728760cbc32c34", + "tests/browser_images.cjs": "007da417cc70a024fb58ad35d741eaeecdedcced9e25f47ee3fa37ecbd4a3ab5", + "tests/browser_images_real.cjs": "a089ad6ca6c2ff189977b35531adc0af91630444b49f2ccfb686193e421d210e", + "tests/browser_images_server.py": "1375a6a1d9e2727949254de9286fe0da51b69cf5cc55709ef5a9430c7cd0eb55", + "tests/browser_instruction_responses.cjs": "db3713ef4a33391255f9ab3657ed2975e4c6bad144e84e78ef34b0695254205b", + "tests/browser_meshes.cjs": "f75733354082f24e3d3f369eb40386599705fb1b09c08e17cf2a005c16844dae", + "tests/browser_metadata_filters.cjs": "e8b88df0932f03cd748b47a23343545f5461dee48813934cb631e79c7d39ec0c", + "tests/browser_metadata_server.py": "7aa0e25bae8eb5bdd523ea1b568e5ac60d9420e3aa8acd97750f95053f07f053", + "tests/browser_native_detection_import.cjs": "8b45927d506612925aaa3d9bf47646031de1e99d43e6fb42293bff01bed5ee59", + "tests/browser_native_text_import.cjs": "5f8e5f2d20a66e35784702a37706b9daac53e73ad1c1e9719978086122e957f2", + "tests/browser_page_load.cjs": "bb74bd6ad97e0ff7c4545c747df698d0466d143764b0ccb52ed26b2051a13318", + "tests/browser_preferences.cjs": "63977d6ac0eaa390f5472cfe86a1943ebf07a6f1e32cb8338bed0128a4b4f70f", + "tests/browser_pumas_gateways.cjs": "e7659f2598680c15c89129df8e05ba4bd8019369d7fb03566616a2091f43b3c5", + "tests/browser_pumas_gateways_server.py": "c17a4b267ea2e1385185f94685eca893691a8f966f46b89c3084e7ba8e8bdc3d", + "tests/browser_pumas_typed.cjs": "9813559dc88426a088e750d785ceaf0c4ed8458011abf58c6f20812613dc8883", + "tests/browser_pumas_typed_server.py": "fc729ef0b1e4cc107dab0fe5fe8a4b2e09fbb97d32f4f282ce5960f7e9f7ea35", + "tests/browser_release_preview.cjs": "bc990461fa95e59d87d75a0185e5fe16685b641ff9e24379f214dc582f558c3a", + "tests/browser_rights_note.cjs": "bee20ec43752ce03b274ef5b4bb35f3b9af1179cb0a723c4bbe081ef80a7fc6b", + "tests/browser_saved_searches.cjs": "6eedc0491497dbec262943cc0d3b0bc1b0aee959f1f4cd4dfe8b53b8cad94b25", + "tests/browser_saved_selection_intent.cjs": "381a2040096227ec0854f2b21519b29e086267e3bc57eec225977152d13821ca", + "tests/browser_saved_selections.cjs": "05276e39fc3744e969999f43d5f6bc9aa1a96c5b7b7e1512a80f111f752594e6", + "tests/browser_scientific_fields.cjs": "cd67c773023520ebad8ac54d09b0f4f0fb8f3bcd78eed6a8942bd6bcce24ac3f", + "tests/browser_sequence_batch.cjs": "eca3a2f69a54919394452dd8703e0584698af4c6fe6712571c69414169cd460a", + "tests/browser_sequences.cjs": "b84c8b41242e0b7ed125251d255de21699cd308e2a94fe755119438062576009", + "tests/browser_sequences_actual.cjs": "60c68f3c637cb394199e9565410981ccfe3daf79dd7b6e7e859df81ba5864c3c", + "tests/browser_server.py": "6c3d57a4e5b5fe75ab866fcf35dc5450a98ed0170d0fbcc03d10f40761dc8d89", + "tests/browser_startup.cjs": "ba7e6c8817489ec6d41b994e57a4f01029e986d2475162fe3b5cc971e6ccf634", + "tests/browser_text_classification_proposals.cjs": "4b2ce497d61759983d1182bc92fb6f2d19f7f84a12897ab28e14efe1b7373bc8", + "tests/browser_text_classification_proposals_server.py": "c21f65529ad95962d295153c0a1f7cb29f03937f1496efa02ea3add4a5f14203", + "tests/browser_text_corpus_export.cjs": "301577b087eb14f8520b93a795d5054f0b128603499dc229a675f9eb40359ea2", + "tests/browser_vlm_real.cjs": "52abd3b48dda40daf5a5efb207c83f5be286b49abda56d44adf1118a82ccff86", + "tests/browser_workbench.cjs": "c7a29ec267bc49c82777bea81af99caf38ea0a7eb0f9b7f7d1bc50d86d4fa218", + "tests/browser_workspace_audio.cjs": "e583d9beaddd01ebb799fc9d82dccd08d6e03f6adbfc53894fafab55436f3b36", + "tests/browser_workspace_audio_run.cjs": "2a15d61e0c1f9e46bd2c8c30e7cd2bcf36a31e0c11a50d1b5b0e9e9ef911f3b8", + "tests/browser_workspace_breadth.cjs": "6304ee3e1065f4fa1d6e52afad51905081f9590792671d37083ea7f573b0d8ff", + "tests/browser_workspace_cpu.cjs": "6911c8b4f568cedcd9691fbe53d2837ba344fb08f423406e9ddaf4114457557c", + "tests/browser_workspace_cpu_training.cjs": "2fec33e09bc63115f2c743370c131e663446dd919aea8516a068aa4599eb8306", + "tests/browser_workspace_export_run.cjs": "fd7737ab67642af283787cbcee8038bccb28660cfd73ac5fed206ee67387a41b", + "tests/browser_workspace_external.cjs": "56f1c7485c4b6fc1181317df93bd370584250426f46c7c6568e1182f7237f8fb", + "tests/browser_workspace_image_run.cjs": "a6156cfb2b3fc70b952e1e7b1be6162d010f064216b655fa5e524be64fd52e1b", + "tests/browser_workspace_mesh.cjs": "23d10526afe02d3564ea508f284e4f8f1526a05e5951fd0427a03457d678e882", + "tests/browser_workspace_mesh_run.cjs": "161735e1dffd95e325f00e4e8476d4de5d1322e11743590d81533698da6ae8bb", + "tests/browser_workspace_native.cjs": "f38102f33e22555859fc49996396ffa73c11d9282469cfd25678b3a904aed645", + "tests/browser_workspace_project.cjs": "6c26a5db25c7e4b9cf01f3defe0f2f6b7b4158074b8bd3487e33b53b2f0de9e8", + "tests/browser_workspace_recovery.cjs": "6508a410717032d2806588504e756325358503a60fc0144c186f1058f612b568", + "tests/browser_workspace_rheon_evaluation.cjs": "333fd9e9735499caeb79d5a1d498a48a16e97758d7914c3e4e7f5c8dcfe66145", + "tests/browser_workspace_sequence_run.cjs": "ecc5aa03a7be9d850d7904ec703958c98d29995b9ee5449774c417a895498400", + "tests/browser_workspace_spatial.cjs": "6a32f7d5c1a7c07338b3c915ca181956140076ddcd907883924e906ed920f16e", + "tests/browser_workspace_text.cjs": "ed4ecd4913a893b5e170ba9e20f78d6d29a4ddb125c0f926996350dbfdced1b5", + "tests/browser_workspaces.cjs": "e40c459a2aca337ffb9043762e8eda4e7c483ac1de816210aa068e368198c191", + "tests/check_image_classification_consumer.cjs": "c51342eba4486e6e7f48377ebabfed9dd2b11d401822eb8323d7f7e4c1aef683", + "tests/check_image_classification_consumer.py": "b8894a0c903ede4217671d817ef4a1ccc081d1f6f8548d99d7c24d375a882697", + "tests/check_instruction_consumer.py": "d2b38df86311be0011aced1046c0fd7a7e8f667dee9b1e783a1ff9a189aab5d7", + "tests/check_preference_consumer.py": "9b33ca4300fe6eac6fea14a1b2d24a598a7b50a60dcc81f224a0c1b0296bbf1c", + "tests/check_text_corpus_consumer.cjs": "d6a851b1ff40fdc1407b2e3807b93d8b2b7dc727d648ec0b3493484d3e031190", + "tests/check_text_corpus_consumer.py": "00bca07ab03912f4e6208c22aba1842b3a0b98111d28bc443d3ea94e0bdd0a26", + "tests/fake_ai.py": "2eece3243b9c1594b7ed0f0a0dd9f20a453838d2e6b73ad058e217f688631a72", + "tests/fake_ai_codex.py": "31ec8bebf169703cae1db8936c84ae983e57ba7d7dfa937e57bad4e575e41b88", + "tests/fake_caption_model.py": "61a34f2584ce3f3de64075478103422fd04e562649875de97f4e029dbceae7b1", + "tests/fake_classification_model.py": "27cb688d1f1c6d55bc742f8265c7a634133c94d94d4758b691e2b45b03fb7ab5", + "tests/fake_grounded.py": "1edf38662b953dfbb6b3ff0460320b820d7bd6b6bbc6c07157835f3aa5a4afb2", + "tests/fake_images.py": "c4a532a749211c6e67a5f7444eee698c8ac51f28cb3f636ddfcc6a9f1f5e4816", + "tests/fake_pumas_typed.py": "95d0a2e8bf652e6f5165a8c2a9a2a5c2e7378c7680cc3e8c615e431210ae07f1", + "tests/fake_pumas_vision.py": "bcdb4abf3ff170f26f6798a306db77f8ec3c370843905ac816e17b8593d47ddc", + "tests/fixtures/diffusion_check_image_data.py": "6a4394308a4cc69b4ca965aca7f8459d7711ac9d51ce70492562c6ec6d806f94", + "tests/fixtures/external_recipe.py": "06815b425a7722e0aa64d0c8739263fc2db371027b382d0c3326691305e1879c", + "tests/fixtures/image_classification_fixture.py": "1e547f650f20e157eb0b3914213b9bd3ad26d989dabffbc975616b0d8fce77b8", + "tests/fixtures/pumas-typed-v1/harness/probe_gateway.py": "79a4e88223fc94517ac00e8bf1f3a3d005fe2f12c527dab436d6c6e916567f5f", + "tests/fixtures/pumas-typed-v1/harness/serve.py": "f3a7debf3a0ab69537cfdf3e9e51222c6ea322cbd47750a20aeac3f2dfacde69", + "tests/fixtures/rheon_controls_authored.py": "385e20e96d0d0216662477491365490dddf5e6d693ced1ef5ac3845b3a9a3d8a", + "tests/fixtures/rheon_source_derived.py": "884fb395fccc7f9f4b0ce82675eba5aec2621887b4ac1d93b71f2ab0abc99d3a", + "tests/fixtures/text_corpus_fixture.py": "6d1cbef5f8f725bd75e16e9190160002f273d80d9e95c654e78ceda35c9c7d0b", + "tests/fixtures/tiny_transformer/model.py": "d304e951615f3bcb9cd5f4158b7348c5ecfd68731d8a5d62bd0d98e837dd1784", + "tests/fixtures/tiny_transformer/train.py": "8d2b908007dabbbd609312f1a22a697b40534b6c5ab07e3d540fd5833295e47d", + "tests/fixtures/tiny_transformer/use_model.py": "34b94d2be0a870fc470d27e61738e7ff193b586122b72724f7a33f2688099957", + "tests/fixtures/train_image_classifier.py": "a198463590d41660c21ae45313b47c3a5baf38889eb9bc029e4c7fe8aa741ac1", + "tests/fixtures/workspaces/audio/classification_fixture.py": "39af3d407b76cc64625e838d78f6e55208bd0f55f6f36ecba3167a7f1b786dd5", + "tests/fixtures/workspaces/audio/make_fixture.py": "6189d6dff75ca84240f1df5a1442d4ab25e4339431c985de25085d7bf41a4e58", + "tests/fixtures/workspaces/image_corpus.py": "16f829699fc2de257bc8acf672af1d143bf74fcfbff33f030664e2745d958429", + "tests/postgres_helpers.py": "eb8398f68b17d8f84309941058872c2d80d73d09e63c2c8cb4af4d8ec59c22bf", + "tests/qa_artifacts.cjs": "592a98a1928f5b791f37fe13b94b5065a293af4c570bd6c3df449bf10ede5927", + "tests/qualify_agent_scientific.py": "da48fbc0c5e02992f911c54608ab5487014027c222bbf247bad8867db932c15e", + "tests/qualify_captured_cpu_runtime.py": "36198b4d7935d31997e4ec5ed48b96a1aaefd4f284c1f737e1b00c840cd386e2", + "tests/qualify_cpu_comparison.py": "ccf1d67354b3898fe6eb2f142c5c5e7665318f218df193259d43843366b436ed", + "tests/qualify_cpu_training.py": "5864c766530180e02cdc8e6a3839df4d6fc56fe42921fef66dc4815bae0f45fe", + "tests/qualify_native_generation.py": "add38a6aa55fbf42dae1508e5c602a512057250a332a27fd878148736aa07053", + "tests/qualify_rheon_evaluation.py": "37b6184a6a36d8f09b16758e7536c015b64fc3155f147b0144b98feaa29b6de5", + "tests/qualify_scientific_fields.py": "8418dba5856172d891375935b0b51bb2ba518db9dbadf4a2ecd8dfee5c625540", + "tests/qualify_spatial_retained_runs.py": "2c7fca75747ab4639c4d9415b6308c7a3a3a46c7a257b76f8d97cb01c32fb358", + "tests/test_access.py": "31a480dfec02e54db48f7a324714a6b101c34193129a71827bcd61e725d813ea", + "tests/test_access_http.py": "25071bf2647fc6d8d3aa6ed525d45f777c01b6a7831f9802958e26a2e57147a7", + "tests/test_agent_api.py": "e457f2c6b1ec5f29632d8b626a03403ae04010f9b080717ddeae1269b92266ad", + "tests/test_agent_domain_parity.py": "7bfdb3259c653ce42a57f1eb6dc11f59209c64b2e3f38ecf9c434d2d900833d0", + "tests/test_agent_http.py": "77ccbd8fc846a832cc3d5e26f5e69fa6c332a1dca9c26add8886f796fe74c210", + "tests/test_agent_workflow.py": "8746878106344a3e28ec199f7280b0c9b3c7f9205b41da84801314083c30a597", + "tests/test_ai.py": "71a1a4b653671ec0c37ecab1a34a69e8e523193741eecfbe1b6298ac8e964aee", + "tests/test_artifact_segments.py": "f4f231c9eb1d2b3e9f478a4b9ee8139f286b3f009290d87f5433a3f97ed3eb6d", + "tests/test_audio_assets.py": "6c63a22d4ba93d41ef0ef6251abb720e50b3c2d240d0fdcd5ae0848d1be8956a", + "tests/test_audio_data.py": "77af876b31b42efc68849b45272b696bf65b8d7b3adf4a125723f14125370f62", + "tests/test_audio_training.py": "1756d9bd3d80202d16fa48e07003e915111db470e7e557369cb0e779aff2f275", + "tests/test_auth_controller.cjs": "ad08a05093dd6a3c96915c265257ecf00dee4575d86c9de796b62bbcb65c6f26", + "tests/test_auth_helpers.cjs": "6e7b9110a84231e4ab34bcfca421e722c15005fa9c7bf51626a72c13dca1a25e", + "tests/test_browser_page_load.cjs": "d062d47a7e7e608a2e97eda018a70ea8edb30e12a5afad2ea951f81ad9d8119d", + "tests/test_browser_startup.cjs": "7d2be37ce682f593407a890013b25268fc595f8cb80c42dd6edc9e2e97373e52", + "tests/test_bulk_import.py": "6c085c2a11bcd52e3a39a1c74a2fc84088160f970c22a99dea9eeec4c27a2d4b", + "tests/test_bulk_import_controller.cjs": "ce193a2f3c6f257d8a3466ae3c8505b3e49b366d4d2ff448899ccbfa4f1b9d52", + "tests/test_caption_exports.py": "170207224c2b2393b701058ff46f73f13f3c6be6d623e451e89f0c3b1e25c40f", + "tests/test_caption_import.py": "83d46023931d671035959dbdc45b1117f4c82b0d4abb110c35cd28274bf28fbf", + "tests/test_caption_import_controller.cjs": "1a5b7ce0beb56c05b68d33c2b65354d24b8de74bdee44e09a3d749a835a0db3a", + "tests/test_caption_proposals.py": "b199041df42538ab7bf15d15700a1639bef49104c33505fad3584db78dbd128e", + "tests/test_caption_proposals_controller.cjs": "f9385428a190f8bfb9e8bfa9b155011d46cda2228b6e35c5524bf28524fb6042", + "tests/test_caption_reload_controller.cjs": "a6c21de93424eece37e5a47d38a5f3c49328d965c48954cc0da6f65f3916eaa8", + "tests/test_combined_workbench.py": "a6ff63d3dc3bb0ee02d2d94f390f4eff052008e2ecb08929e5be2d65b0921404", + "tests/test_combined_workbench_controller.cjs": "cb323e44713dff35ddbf291f20ef5bbd4054194634c6a73dcadf79b9a7a0a7b8", + "tests/test_cpu_recipe_contract.py": "1a45b1e6f4f58d3a2002686aed4f04afc7f8736cd618641769bb5e6f8c762ec5", + "tests/test_curation.py": "d0d592e869fe6ce4dd923ad5e6df7ba0f4357d337a4584419fd1206c0c21f144", + "tests/test_curation_controller.cjs": "e60b14423fc485fae0f3e12cb217cb0df7501882f985ab791ce91ca50de44cee", + "tests/test_dataset.py": "0938fcc8819dd0aaf4b400e8a715027a8d184c4dbe3f5789cc701ad1177383e4", + "tests/test_dataset_releases.py": "32ee71ced83f17717980c1eb4375611b2483dbef9937c3e9b43a80817168e550", + "tests/test_execution_approvals.py": "8368601c1cdb90504533e7f88a515101e7362ac780380224fac8a925c936bb2b", + "tests/test_export_runs.py": "926d86a6331f90f61f846ca421aee0e6ebab650667788fa0c4ec2195c659d401", + "tests/test_external_artifacts.py": "54373e580b3c806515d6bab29387614a226104113fecc782edc0b601c65a3a44", + "tests/test_external_http.py": "dff9afebade39bc530575f19defbe6064ac39b5406a9e461fca7f1af6cf6e72c", + "tests/test_external_progress.py": "1dd5a8a194fcdb182f7d22595160e1bf6eb97749a3bb90da79d0f1d9a05077f0", + "tests/test_external_runs.py": "59931dd73ebe7531e793a6dbe5ac4f9f9d5a6c8d6eb2df83930611d7e99118a4", + "tests/test_frozen_recipe_inputs.py": "2257212c8a2719862dc13f8c4ba86bce6e0a927c69a77da183802b248b85a44d", + "tests/test_gateway_discovery.py": "f67eaab50db54e1abac9bfadb51b1bfc807f43c8286dd8ebc4e1126f8f84edc9", + "tests/test_generation_job_api.py": "bcb9c18eec21034eb1079c2a222e7a0d2ab447de2c2392833baac3902713151c", + "tests/test_grounded_candidates.py": "eacfca315f4d1046a3e23b5fc12213c8e75167a56d4cf58acd95a5224d0c2a5f", + "tests/test_image_classification_export.py": "f1a93a4c638a563cd481668b80d05ed48b0a57e58f021cccf8c3ded5c3d06e44", + "tests/test_image_classification_export_controller.cjs": "c21a1d9b64116396dc4e007b7f07b81d28a1151ba548e415bfd45274effc12a4", + "tests/test_image_generation.py": "2c4dc04957f25497c7b84cf4870efeba85f171aabbbc9c798ead0ee36c554e7f", + "tests/test_image_training.py": "1a1dcb3bf330ab3b9790cfbccbddebc5444e2c8703403cc40b5e3e81e882b01d", + "tests/test_instruction_responses.py": "f6754faa43b35b43839ac968acd7c05a2197576ff4e355e237e783a992ba0d7d", + "tests/test_instruction_responses_controller.cjs": "bcc6df5ace74be696f4b9ca98e0475be65d76c9ceedfdbba8dcac443fae9d8f8", + "tests/test_large_recipe_contract.py": "de97172774e68031adc520b1917bf629f6906188421ae0840704c0833077eca3", + "tests/test_mcp_stdio.py": "8098c7a1485e7e31b2240dc6790b26e0eaaf481753087b0407fff0cd2b85b91a", + "tests/test_mesh_release.py": "cc57a6d4b58cd96551d25a46631945a45c7dc39a21a869e563068a021ec89c20", + "tests/test_mesh_runs.py": "f03b012c0fa7649fb25ab2464977980066fa886fb26fc417111e802dcab47267", + "tests/test_meshes.py": "d9d36438aba8cce733e4a7a67559ea45095b797311d53392089389d0b1de5d38", + "tests/test_meshes_controller.cjs": "a5137a40c573a2c0a73740ebb1133c5fb263030bbc8077a8bae14b2ca496d242", + "tests/test_metadata_filters.py": "fef2682f8c6a2e7d1ed58dc08fba8d653edd98a76578d7cc012841a959b25631", + "tests/test_metadata_migration.py": "9de22c42dddf41066586bbde1c6852ad09bdb1730a3ce9a25826658924046e9c", + "tests/test_metadata_transactions.py": "14d9155639c6d613c75be318effe7413be14998c848c455cd92c87d266623c4c", + "tests/test_metadata_workers.py": "fd9b624410ad3d32aea5bc77b3739a9aa8207f6d9a0da3bec27b0f54d72462c5", + "tests/test_native_detection_import.py": "2eb4e8ab069bf2636ce9cfb17c2ed7286d82349324f8a073037906aa9c59a751", + "tests/test_native_detection_import_controller.cjs": "4690e65d8a85cfd4492bd8136f218c482fc32562bebc198f515ee7057e3545a9", + "tests/test_native_detection_stack.py": "5e8e2e955f9b6ae0b0f702cd48fea922995bcfc296783df1abbe152836d69b25", + "tests/test_native_text_import.py": "86d347c27587214062a6cf7a0d1d8799d4422818117a6cc9e26b1bf90aff69d0", + "tests/test_native_text_import_controller.cjs": "98e550c365133b1954537114cab78dcec4ba03ba395e622c591f13f4ba8e2742", + "tests/test_pipeline.py": "bda005471eafc061482990a59d16ce91924bbf46e31b1a0f2a766e16be694bbc", + "tests/test_pointclouds.py": "4551a41de6f0d45bd123c8d640324613e698e1683c9a663fa0a47c07f1cefa9e", + "tests/test_preferences.py": "f3c6591965b9a14e4623940ad02696339452ddd0910ffdff4d617ce1b40e28dd", + "tests/test_preferences_controller.cjs": "24cb8f6f7d1cfb61089412eb6df5138a27faf6263130887fc69ad87626f99694", + "tests/test_projects.py": "29fa8a8a421a764a13605a087a6432b7671b01a5ba6511948beadf112b9b7d2e", + "tests/test_pumas_gateways.py": "c716d118e3e6ba0723f7751eb20b6c5cd496b3590f0e82d3341b150e9457621a", + "tests/test_pumas_gateways_controller.cjs": "96dc99ae0ce6cc6da6dece8288aad3595a323121a69bf2794091287a4c9145c5", + "tests/test_pumas_typed.py": "9b53bd8792b1b2330bc326f626cc3f91e050a7d9687c512018c35c110b2d5edf", + "tests/test_pumas_typed_controller.cjs": "7c53d8407fdc0bfd540292f937bfb71bf5cb3be96e5b4aecca22ed1ddc84df63", + "tests/test_pumas_vision.py": "0bc9d1d055ab60167fbf808cfa83e63b7a9e59694dd51bc00602218632bc54d4", + "tests/test_qa_artifacts.cjs": "1fc4c29daf0ea6603ff858fe3eca865eee428800b709bfbee9603ad3234ec376", + "tests/test_qa_qualification.py": "539abd5c349b2fd899cab9dd4b64d618d9e0012eaf2f06a5bdb2e8bec795f599", + "tests/test_real_import_foundation.py": "92c10da87b4c0a6593ff0546f9a89656ad2516b590e1a5cde903785a46731b12", + "tests/test_recipe_contract.py": "5eadd7cab5ddeb808d58c125647e4aeb34ae1030c0bbca2110a1d319d946b6bb", + "tests/test_recipe_process.py": "eccc63d300a487984f1fb253130c52a79312feb7db7c8429a13703792735c0e3", + "tests/test_release_preview.py": "ee8f1f2701c4cddc7d0c7fdd211894428620f0415d8caf0bbdc931a7e7936f79", + "tests/test_rheon_adapter.py": "ba5eec5328528598fac13ac7d96030a7e9b7290371cc54d6b05a76ffc69af56e", + "tests/test_rheon_cpu_adapter.py": "5e278f8d0060b9d1009ac89650a7f7ce635adb9cdae5a82960f1d3360a79b1f7", + "tests/test_rheon_cpu_training.py": "d520bb23a2b24561e9ae91664e6b37ceed3d61d7265d59aa922b9b92b46e2aba", + "tests/test_rheon_evaluation.py": "0469b965073a3c71f6637e0ef7e17158fb494fa43fe44b1a45ae59c291e97d53", + "tests/test_rights_note.py": "fbffc75b8651f739e1b98989e7c8e4708260580a73471a70d7d1b15e00b857b6", + "tests/test_rights_note_artifacts.cjs": "8922f55d613f9b63e37ea53670acebe6efea7fc4923a53410ae2a8a065b13ddd", + "tests/test_rights_note_controller.cjs": "7f9f3a50684b8270101e3341171ac46d2b08c9efea8867ed41865223ef1e93a6", + "tests/test_run_recipe_inputs.py": "5906e4f48bb038e0a03821e3be845ecca36bbe688bd67158116f8ddd1e6f9ca3", + "tests/test_run_scientific_import.py": "38619c38d6935c2b78f30eab477fa7083fbeeba5ff60676535d438ed99527cb9", + "tests/test_runs.py": "15e0342e5f7b146c6cb70a28816756b9e1348b0ab152440ae32882c67e4eb501", + "tests/test_runtime_snapshots.py": "4a932759b55d641a6aeb329430b43460c0f1afea3a4d3cd2a3f1c3051ab376d0", + "tests/test_saved_generation.py": "546ea3db08c0d772a3616f4dc00757b2cd0c6c14ad056f5783527d391a122a5a", + "tests/test_saved_searches.py": "fc3f5b0a12835be2fa629e1622ab1413bdbae7cf7c3632caf7a5225fdb277300", + "tests/test_saved_searches_controller.cjs": "918baa9325b91ca5e23c3b20366a10e6f206827e7386d5422d08b2b72dc44b55", + "tests/test_saved_selection_intent.cjs": "bfad6b7ea3e094e64a5ad0cc39fa7a17073e17bc32cb898fea1022be8b36ccb9", + "tests/test_saved_selections.py": "560a1fcb6766abfa706dc642c73b8d91fb171a3e007e49604163f281f906dc8a", + "tests/test_saved_selections_controller.cjs": "5d04684415739d4b42dce8663bfbfbf38308330160d196fa073aa91d0c18cd26", + "tests/test_scientific_fields.py": "868b4294fe3aaa258796a562eed44b49e49f29585e05107e9e2ce7a21b908154", + "tests/test_scientific_release.py": "1976d3708e04503f8a94e9f2918487dfc4c9c961849efe48fc8171a9a2db4d95", + "tests/test_sequence_batch.py": "c8be7c857d37ca11d8e52878115eea5c93a21e7baa50ec2261c1a1fc1a6b7054", + "tests/test_sequence_batch_controller.cjs": "d487f8d51d7835e2abcc92441d8aa24a3fa35090daced0d85e40be9993f11d34", + "tests/test_sequence_release.py": "a7457466674f48bb08cde5237b80d5ca770128b22f5f359ecd4bc90d12d30819", + "tests/test_sequence_runs.py": "09b9861d05f0a5dc0b9da2390f1eff63dba25662ae599fd0ae59e7b7fddbf53a", + "tests/test_sequence_v2_runs.py": "c0a01076f9869f366bd9de96f6b8e338a747d8abc5a1867ab6cdab88869f6e5e", + "tests/test_sequences.py": "0e305b0eeb718893e857a355998345137fe043c5cbce46b29b91046e91d15688", + "tests/test_sequences_controller.cjs": "47180b1e6b0cdc2b4182ecac4c962d196d6545840abec0b3f98970fcf4e08807", + "tests/test_sequences_v2.py": "ebf96c2cf91e7e05e780f5d46f53f0eb98fc13cc197af818628ec8cd34958f40", + "tests/test_spatial_controllers.cjs": "15eba02632ddd3ab17ea6a6288bf0bd70347093955aaae678877f6a11bb82c59", + "tests/test_spatial_release.py": "823cd95654cfa8be17f07b6e6c84fe00b03024beee81f8ca9f5a3cbfa051f49d", + "tests/test_spatial_runs.py": "59d1c53542e15cfeb78922be8e366aaec2db541a7a1cbb69710ade249951a99b", + "tests/test_spatial_storage.py": "dc9e0588b73b5fc03b296d1382c4e131571dd1b261c2424f4beff15b0ddaccb0", + "tests/test_synthetic.py": "7d077c66a532efd57ea29347641f7962b4687baa664b5d339a0ed2b1223fcd52", + "tests/test_text_classification_proposals.py": "7ecf4870d58e915dbcf74546e531ad28939eb837170401e88f07346ae4de51b3", + "tests/test_text_classification_proposals_controller.cjs": "00bcaa0f32754e6c7af542500ddbbd6ce39a2c2679a0d989a6a354e06c323d7d", + "tests/test_text_corpus_export.py": "c8f840ec9263c9e8f70b0e93da9632d1d1258b0690718ded9b3685ed9a3145c7", + "tests/test_text_corpus_export_controller.cjs": "dbe4401c84d9a759bc3991ca5a91bef6e673806276799a64a0d92d53f3d6c826", + "tests/test_text_training.py": "94481a278c29a056018fa27585ca712ea38ba7ba57663628ae4be10022ee374b", + "tests/test_volume_assets.py": "11519cefc7c0bffba7f878336465f2e16b5b70b65cd480f5326bb06afa4acbfd", + "tests/test_workbench.py": "97fd968831531fc750f564f3e23dc3b021662a4d955939e82f5048dd87c69ef5", + "tests/test_workbench_controller.cjs": "17dfb3ae38c9143e41ce0242a3b06e5a6f32d65e62f47c6f364de6619ca2e1bd", + "tests/test_workspace_contracts.py": "b281d64940892b0408702b0b6fa1346daec018fcbfbb5b75ef955158bd8b6f41", + "tests/test_workspace_external_controller.cjs": "4f8c942c9cab5a9a1fd5fd3a965e5cfe0df88d6bb07f66434a724a6577a8e111", + "tests/test_workspace_metadata.py": "3bc9a6823935329588d0eee7d2ddf6960ff4bd4d12df9cd736d19badb2cd4ac5", + "tests/test_workspace_offline.py": "03a277e830dd8c5a2947d2158276b9207b675ae7c75f2562f3e6172acd93eb4b", + "tests/test_workspace_service.cjs": "6d6d61ceec55f7f57640d382b97a80b8a85ba756c7aab0ec52eb13d3e8944b84", + "text_classification_export.py": "2510ad278a95892d4453ffb5b146ae47c11f8e31f3dc4cf9fb005eec79270bdf", + "text_classification_proposals.py": "6a29dfe752be4ae2c69d7b2e4ca3e68e87dc511cfee2429093748b4ccc56c86d", + "text_corpus_export.py": "3af4883df1b714519fb4e9be872f39de20dc3013deca720e32a89789cbdbff69", + "text_training.py": "9794c343af00854519be0873bad766eadf681c4826be010efb3423cae1d0974e", + "upgrade_metadata.py": "df798ada0b929fd329c42add8545109422b5821874aeb4c913c4ef5290015525", + "volume_assets.py": "1e057fcec996969e0a9b44ae7561fb7b6ea95b6201a23617fdbbc3a046b610c1", + "workbench.py": "e2735b9242040b471f67ff3663316397a58fba19338cc79058796106e7ef5562" + }, + "changed_during_resumed_gates": {}, + "finished_utc": "2026-10-13T22:25:42.106249+00:00", + "javascript_gates_expected": 56, + "javascript_gates_passed": 56, + "base_active_api_tests": [ + "test_discovery_is_stdlib_only_in_cold_process", + "test_fixed_endpoint_and_private_configuration" + ], + "optional_api_tests": [ + "test_all_operation_schemas_and_route_projections", + "test_draft_tasks_and_no_human_or_programmatic_review", + "test_integer_unicode_nonfinite_and_closed_subobjects", + "test_bindings_known_graph_drafts_and_no_executable_topology_requirement", + "test_import_bytes_bound_is_aggregate", + "test_exposure_grant_and_projection", + "test_authenticated_discovery_proxy_ignored_and_one_mutation", + "test_framing_identity_registry_refusals", + "test_unknown_commit_is_not_retried_or_secret_echoed", + "test_absolute_header_deadline_includes_trickle", + "test_typed_error_and_success_shapes", + "test_segment_reassembly_and_whole_hash_tamper", + "test_image_forwards_exact_raw_base64", + "test_revoked_discovery_preserves_http_status_and_code_without_mutation" + ], + "original_base_summary": { + "tests": 900, + "unittest_seconds": 1324.06, + "failures": 1, + "errors": 12, + "skipped": 16, + "failing_tests": [ + "ERROR: test_absolute_header_deadline_includes_trickle (test_agent_api.ClientTests.test_absolute_header_deadline_includes_trickle)", + "ERROR: test_authenticated_discovery_proxy_ignored_and_one_mutation (test_agent_api.ClientTests.test_authenticated_discovery_proxy_ignored_and_one_mutation)", + "ERROR: test_unknown_commit_is_not_retried_or_secret_echoed (test_agent_api.ClientTests.test_unknown_commit_is_not_retried_or_secret_echoed)", + "ERROR: test_segment_reassembly_and_whole_hash_tamper (test_agent_api.OutputTests.test_segment_reassembly_and_whole_hash_tamper)", + "ERROR: test_typed_error_and_success_shapes (test_agent_api.OutputTests.test_typed_error_and_success_shapes)", + "ERROR: test_image_forwards_exact_raw_base64 (test_agent_api.ParityRegressionTests.test_image_forwards_exact_raw_base64)", + "ERROR: test_revoked_discovery_preserves_http_status_and_code_without_mutation (test_agent_api.ParityRegressionTests.test_revoked_discovery_preserves_http_status_and_code_without_mutation)", + "ERROR: test_all_operation_schemas_and_route_projections (test_agent_api.RegistryTests.test_all_operation_schemas_and_route_projections)", + "ERROR: test_bindings_known_graph_drafts_and_no_executable_topology_requirement (test_agent_api.RegistryTests.test_bindings_known_graph_drafts_and_no_executable_topology_requirement)", + "ERROR: test_draft_tasks_and_no_human_or_programmatic_review (test_agent_api.RegistryTests.test_draft_tasks_and_no_human_or_programmatic_review)", + "ERROR: test_exposure_grant_and_projection (test_agent_api.RegistryTests.test_exposure_grant_and_projection)", + "ERROR: test_integer_unicode_nonfinite_and_closed_subobjects (test_agent_api.RegistryTests.test_integer_unicode_nonfinite_and_closed_subobjects)", + "FAIL: test_import_bytes_bound_is_aggregate (test_agent_api.RegistryTests.test_import_bytes_bound_is_aggregate)" + ], + "log_sha256": "1e3f957574c4c8ea0b5d2f1ed4ce6aed1a9310127bcb9fef393f628b48e8779f", + "qualification": "Failed original full run; only optional API tests failed. No claim of passing full patched discovery." + }, + "post_gate_head": "75c8ca734a5616986d2eca8d0f695068d603ba04", + "patch_sha256": "598f5e690018a6396f54bad997b5b221fcdb8366b8b290fee3a74f209b933c79", + "git_diff_check_exit_code": 0 +} diff --git a/docs/plans/generic-scientific-projects/reports/p6/scientific-mcp-receipt.json b/docs/plans/generic-scientific-projects/reports/p6/scientific-mcp-receipt.json new file mode 100644 index 00000000..679dc75e --- /dev/null +++ b/docs/plans/generic-scientific-projects/reports/p6/scientific-mcp-receipt.json @@ -0,0 +1,1580 @@ +{ + "qualification": "Actual official SDK stdio agent \u2192 authenticated HTTP \u2192 existing scientific owners; byte parity only", + "new_model_execution": false, + "new_scientific_acceptance": false, + "source_commit": "b02004acacc87a0d9cf66edf10b492d8845f0976", + "catalog_id": "d4856fe9eec74aea8b007cca029b3248", + "actor_id": "51a8d17f3be74810b8c1e7a63cab546f", + "scopes": [ + "inspect" + ], + "protocol_version": "2025-06-18", + "run_id": "e731c9569b7d41f9a8f6cde438dcf9ac", + "training_run_id": "11fc2be1aada490f9b67c11c190728f6", + "record_id": "9df813a605d746709eb0c245f16f4033", + "run_and_graph_lists_unchanged": true, + "reviewed_record_exactly_unchanged": true, + "typed_slice_exact_prior_HTTP_match": true, + "transferred_artifacts": [ + { + "name": "input-model.pt", + "bytes": 272149, + "sha256": "e08e85d991d2734383d14501d6dcfdaccb45dfd53370d883c26b44e84255f5f8", + "segments": [ + { + "offset": 0, + "bytes": 272149, + "sha256": "e08e85d991d2734383d14501d6dcfdaccb45dfd53370d883c26b44e84255f5f8" + } + ], + "verification": "complete_reassembled_hash_matches_prior_HTTP" + }, + { + "name": "fields-learned-900-000.zip", + "bytes": 38196421, + "sha256": "b5d6782890e3d2449cb661d897eea9eaff918dc0cba68a5220abcabd27b525e7", + "segments": [ + { + "offset": 0, + "bytes": 8388608, + "sha256": "f6213c91a4c33e301b7be33e233dbc1066b1b3532f3c7123d13143784be44e68" + }, + { + "offset": 8388608, + "bytes": 8388608, + "sha256": "fbe4897fd3cfb70bd305ed60067a57af87aae1fb8d6bb14a976f4533b5414d13" + }, + { + "offset": 16777216, + "bytes": 8388608, + "sha256": "277e385f5cf3f99d38fb79a7423989809e687542204888b0252217945883029c" + }, + { + "offset": 25165824, + "bytes": 8388608, + "sha256": "25af36c4d671262964a682e05c15aa0fff398f7f9f7fe312995129a06a98b495" + }, + { + "offset": 33554432, + "bytes": 4641989, + "sha256": "a6832ce770dc5fd363fa297ddbb04121df3f624ccf049c031d04e0b425dba67c" + } + ], + "verification": "complete_reassembled_hash_matches_prior_HTTP" + } + ], + "calls": [ + { + "operation": "identity.get", + "status": 200 + }, + { + "operation": "context.get", + "status": 200 + }, + { + "operation": "projects.list", + "status": 200 + }, + { + "operation": "projects.get", + "status": 200 + }, + { + "operation": "recipes.inspect", + "status": 200 + }, + { + "operation": "runs.list", + "status": 200 + }, + { + "operation": "graphs.list", + "status": 200 + }, + { + "operation": "data.get", + "status": 200 + }, + { + "operation": "runs.get", + "status": 200 + }, + { + "operation": "runs.get", + "status": 200 + }, + { + "operation": "graphs.get", + "status": 200 + }, + { + "operation": "runs.progress", + "status": 200 + }, + { + "operation": "data.scientific", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.artifact_chunk", + "status": 200 + }, + { + "operation": "runs.list", + "status": 200 + }, + { + "operation": "graphs.list", + "status": 200 + }, + { + "operation": "data.get", + "status": 200 + } + ], + "context": { + "version": 1, + "mode": "real", + "dataset_id": "d4856fe9eec74aea8b007cca029b3248", + "recipe": "image_classification_v1", + "execution": "optional_local_cpu" + }, + "projects": { + "mode": "inspection", + "roots": [ + "sample" + ], + "projects": [ + { + "id": "11004efb19804e34bc342e0d2a1c22ef", + "name": "Authored CPU qualification; no historical model", + "root": "qualification", + "manifest_path": "project.json", + "manifest_sha256": "b8a52afef4eea5696859e4897cc2e4517de4e8130570edf7cc03e0d1a3319c28" + }, + { + "id": "2bb9ea2692a844e085017f273fece2a4", + "name": "Rheon frozen-field CPU training", + "root": "sample", + "manifest_path": "project.json", + "manifest_sha256": "a6d479f6cc7fbbd811a36c7e958af566d0269a975683c76c208203b3222a5d24" + }, + { + "id": "93f681779a064eedba4b64d81d6ce3df", + "name": "Authored CPU qualification; no historical model", + "root": "qualification", + "manifest_path": "project.json", + "manifest_sha256": "edc99ade95700991d2753a62663fee82af45460f1180b60595277113a5aea096" + }, + { + "id": "a32555aabdee479ab94a9cb4159f5a73", + "name": "Rheon autonomous CPU evaluation", + "root": "sample", + "manifest_path": "project.json", + "manifest_sha256": "2c62475bb274ac92205fc4f79f899dccd52a775332f7ea069b332b8cb30f9ad6" + }, + { + "id": "d26f1f282e1d4fd9a07a0ed5f49a49cc", + "name": "Authored CPU qualification; no historical model", + "root": "qualification", + "manifest_path": "project.json", + "manifest_sha256": "7ffddd2045d580980a064b17d3f84bc3253b3ed37f94f7a59086c0c6018cb4c5" + }, + { + "id": "dfbccc62dbb0404e98cd56b3cf05e373", + "name": "Rheon bounded field generation", + "root": "generator", + "manifest_path": "project.json", + "manifest_sha256": "9686d0baa9bec97277bbb58a51f569a2655196f62bd18e99fb46531f87813f5f" + }, + { + "id": "e8820cf8038f437095747d2533d75125", + "name": "Rheon frozen-field CPU training", + "root": "sample", + "manifest_path": "project.json", + "manifest_sha256": "1ab7c1efb9e3e0ca3ec080bb4e71ada5bb3798efeef936984f2cdb9dd683b4fe" + }, + { + "id": "eb159f6356594672bdfdb9e93c495f64", + "name": "Rheon CPU checkpoint comparison", + "root": "sample", + "manifest_path": "project.json", + "manifest_sha256": "282dd38cbe8dfb7987af381d28d992364623139aacf7af51aabb4427ec4814c1" + } + ] + }, + "project": { + "id": "a32555aabdee479ab94a9cb4159f5a73", + "name": "Rheon autonomous CPU evaluation", + "root": "sample", + "manifest_path": "project.json", + "manifest_sha256": "2c62475bb274ac92205fc4f79f899dccd52a775332f7ea069b332b8cb30f9ad6", + "mode": "inspection", + "execution": "unsupported", + "manifest_status": "unchanged", + "data": [ + { + "id": "build_receipt", + "label": "Parallel build evidence", + "path": "build-receipt.json", + "sha256": "4eb9f3b83c77261bf49ce4f2d5718b615d4d70aeb68513b9eface8ccf03e6620", + "status": "available", + "integrity": "verified", + "bytes": 10805, + "observed_sha256": "4eb9f3b83c77261bf49ce4f2d5718b615d4d70aeb68513b9eface8ccf03e6620" + } + ], + "recipes": [ + { + "id": "evaluate", + "label": "Evaluate completed training checkpoint", + "path": "recipe.json", + "sha256": "777fccef814adfeb7afcf599cb56e31faf361b4c6afbd3e80b5b899c87ce271b", + "status": "available", + "integrity": "verified", + "bytes": 11150, + "observed_sha256": "777fccef814adfeb7afcf599cb56e31faf361b4c6afbd3e80b5b899c87ce271b" + } + ], + "evidence": [], + "requirements": [ + { + "id": "completed-training", + "label": "Bind four verified artifacts from one completed training Run", + "status": "unverified", + "reason": "Declared requirement; no runtime probe is executed." + } + ] + }, + "recipe": { + "definition": { + "arguments": [ + { + "literal": "--checkpoint" + }, + { + "input": "checkpoint" + }, + { + "literal": "--freeze" + }, + { + "input": "freeze" + }, + { + "literal": "--training-inputs" + }, + { + "input": "training_inputs" + }, + { + "literal": "--training-result" + }, + { + "input": "training_result" + }, + { + "literal": "--build-receipt" + }, + { + "input": "build_receipt" + }, + { + "literal": "--native-policy" + }, + { + "native_policy": "lab/target/release/rheon-trajectory-parallel" + }, + { + "literal": "--input-evidence" + }, + { + "input_evidence": true + }, + { + "literal": "--runtime-snapshot-sha256" + }, + { + "literal": "cc54ef199fc192b70f702e85dda70bfc8697bf3220373ae9f031afd8b237f0a7" + }, + { + "literal": "--output" + }, + { + "output_dir": true + } + ], + "entrypoint": "evaluate.py", + "environment": {}, + "format": "external_recipe_v1", + "id": "rheon-autonomous-evaluation", + "inputs": { + "build_receipt": { + "max_bytes": 1048576 + }, + "checkpoint": { + "max_bytes": 1048576 + }, + "freeze": { + "max_bytes": 2097152 + }, + "training_inputs": { + "max_bytes": 2097152 + }, + "training_result": { + "max_bytes": 4194304 + } + }, + "name": "Rheon autonomous CPU evaluation", + "native_sources": [ + "lab/target/release/rheon-trajectory-parallel" + ], + "outputs": [ + { + "max_bytes": 134217728, + "path": "jacobi-900.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-900.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-901.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-901.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-902.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-902.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-903.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-903.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-900.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-900.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-901.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-901.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-902.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-902.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-903.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-903.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 335544320, + "path": "viewport.json", + "required": true, + "role": "evaluation_viewport" + }, + { + "max_bytes": 33554432, + "path": "result.json", + "required": true, + "role": "evaluation_result" + }, + { + "max_bytes": 8388608, + "path": "evaluation-receipt.json", + "required": true, + "role": "evaluation_receipt" + }, + { + "max_bytes": 1048576, + "path": "input-model.pt", + "required": true, + "role": "checkpoint" + }, + { + "max_bytes": 2097152, + "path": "input-freeze.json", + "required": true, + "role": "source_freeze" + }, + { + "max_bytes": 2097152, + "path": "input-training-receipt.json", + "required": true, + "role": "training_inputs" + }, + { + "max_bytes": 4194304, + "path": "input-training-result.json", + "required": true, + "role": "training_result" + }, + { + "max_bytes": 1048576, + "path": "input-build-receipt.json", + "required": true, + "role": "source_build" + }, + { + "max_bytes": 65536, + "path": "result-summary.json", + "required": true, + "role": "result_summary" + } + ], + "parameters": {}, + "resources": { + "max_output_bytes": 3500000000, + "profile": "captured_cpu_large_outputs_v1", + "wall_seconds": 2400 + }, + "runtime": "captured_cpu_python_v1", + "runtime_snapshot_sha256": "cc54ef199fc192b70f702e85dda70bfc8697bf3220373ae9f031afd8b237f0a7", + "schema_version": 1, + "sources": [ + { + "path": "cpu_compare.py", + "sha256": "e2e14eb6f354b88a0123bcdd710d4f990102efb97f7cdb584db4700e7f05ab97" + }, + { + "path": "evaluate.py", + "sha256": "ba212546b6bbe404ed88913647a8454c0f7413558e02e638aad7096eba4b2798" + }, + { + "path": "generate.py", + "sha256": "c50277e7121de8153e8056e83e67b20aa610c335eabccd2b229ae475313f0d9c" + }, + { + "path": "lab/scripts/trajectory_cpu.py", + "sha256": "f8479f2667fd91fe83bf6c2d66fd1fb9cd9b60d960615b25f528ccac700ba039" + }, + { + "path": "lab/scripts/trajectory_experiment.py", + "sha256": "e1fd053f693730d39ded6a7ee50fd6e562bef37b2171bb7ed26acb770605e2f6" + }, + { + "path": "lab/scripts/trajectory_model.py", + "sha256": "83e93e75bbe05a8dfc8e8dc416b333d6d2e2614613ba45b4f77f99bb94f9a0b4" + }, + { + "path": "lab/scripts/verify_parallel_results.py", + "sha256": "9d4bd626bbd4352102c11765a47040a37e729a15d5074211f5e60b5bc9ab31ad" + }, + { + "path": "lab/target/release/rheon-trajectory-parallel", + "sha256": "583c939548d68ec7b25cf60bb9434ca1416f28ab6c06b3cad68a1aaf10b344db" + }, + { + "path": "native_transport.py", + "sha256": "4155a3467052b291cea0bd8a9018122796851c0fc8499d8866cca28a2fdf821c" + } + ], + "version": 1 + }, + "receipt": { + "project_id": "a32555aabdee479ab94a9cb4159f5a73", + "manifest_sha256": "2c62475bb274ac92205fc4f79f899dccd52a775332f7ea069b332b8cb30f9ad6", + "reference_id": "evaluate", + "path": "recipe.json", + "measured_sha256": "777fccef814adfeb7afcf599cb56e31faf361b4c6afbd3e80b5b899c87ce271b" + }, + "parameter_definitions": {}, + "inputs": { + "build_receipt": { + "max_bytes": 1048576 + }, + "checkpoint": { + "max_bytes": 1048576 + }, + "freeze": { + "max_bytes": 2097152 + }, + "training_inputs": { + "max_bytes": 2097152 + }, + "training_result": { + "max_bytes": 4194304 + } + }, + "outputs": [ + { + "max_bytes": 134217728, + "path": "jacobi-900.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-900.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-900-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-901.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-901.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-901-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-902.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-902.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-902-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "jacobi-903.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-jacobi-903.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-jacobi-903-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-900.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-900.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-900-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-901.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-901.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-901-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-902.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-902.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-902-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 134217728, + "path": "learned-903.npz", + "required": true, + "role": "evaluation_arrays" + }, + { + "max_bytes": 262144, + "path": "wire-learned-903.json", + "required": true, + "role": "native_wire_index" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-000.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-001.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-002.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-003.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-004.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-005.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-006.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 41943040, + "path": "fields-learned-903-007.zip", + "required": true, + "role": "scientific_fields" + }, + { + "max_bytes": 335544320, + "path": "viewport.json", + "required": true, + "role": "evaluation_viewport" + }, + { + "max_bytes": 33554432, + "path": "result.json", + "required": true, + "role": "evaluation_result" + }, + { + "max_bytes": 8388608, + "path": "evaluation-receipt.json", + "required": true, + "role": "evaluation_receipt" + }, + { + "max_bytes": 1048576, + "path": "input-model.pt", + "required": true, + "role": "checkpoint" + }, + { + "max_bytes": 2097152, + "path": "input-freeze.json", + "required": true, + "role": "source_freeze" + }, + { + "max_bytes": 2097152, + "path": "input-training-receipt.json", + "required": true, + "role": "training_inputs" + }, + { + "max_bytes": 4194304, + "path": "input-training-result.json", + "required": true, + "role": "training_result" + }, + { + "max_bytes": 1048576, + "path": "input-build-receipt.json", + "required": true, + "role": "source_build" + }, + { + "max_bytes": 65536, + "path": "result-summary.json", + "required": true, + "role": "result_summary" + } + ], + "runtime": "captured_cpu_python_v1" + }, + "graph": { + "edges": [ + { + "from": "input", + "input": "data", + "output": "data", + "to": "execute" + }, + { + "from": "execute", + "input": "artifacts", + "output": "artifacts", + "to": "output" + } + ], + "id": "d812191ec20f48379ece4369329c3784", + "layout": {}, + "mode": "real", + "name": "Autonomous CPU evaluation \u00b7 exposed seeds 900\u2013903", + "nodes": [ + { + "definition_version": 1, + "id": "input", + "parameters": { + "expected_sha256": "777fccef814adfeb7afcf599cb56e31faf361b4c6afbd3e80b5b899c87ce271b", + "inputs": { + "build_receipt": { + "expected_sha256": "4eb9f3b83c77261bf49ce4f2d5718b615d4d70aeb68513b9eface8ccf03e6620", + "reference_id": "build_receipt" + }, + "checkpoint": { + "artifact_name": "model.pt", + "expected_sha256": "e08e85d991d2734383d14501d6dcfdaccb45dfd53370d883c26b44e84255f5f8", + "kind": "run_artifact", + "run_id": "11fc2be1aada490f9b67c11c190728f6" + }, + "freeze": { + "artifact_name": "freeze.json", + "expected_sha256": "020ac431def0540edca65b6009ee77ebf8a5eff414efd9cf7da38532ef711792", + "kind": "run_artifact", + "run_id": "11fc2be1aada490f9b67c11c190728f6" + }, + "training_inputs": { + "artifact_name": "input-receipt.json", + "expected_sha256": "1a8ec140ce18fee118ba9821353a2538b3caf8ab89b73a678bd8acdf03bed189", + "kind": "run_artifact", + "run_id": "11fc2be1aada490f9b67c11c190728f6" + }, + "training_result": { + "artifact_name": "result.json", + "expected_sha256": "9b680ad1780fe276b5385805a06dcc3acb365f6b3475481af20e982e6495aa79", + "kind": "run_artifact", + "run_id": "11fc2be1aada490f9b67c11c190728f6" + } + }, + "project_id": "a32555aabdee479ab94a9cb4159f5a73", + "recipe_id": "evaluate" + }, + "type": "input" + }, + { + "definition_version": 1, + "id": "execute", + "parameters": {}, + "type": "execute" + }, + { + "definition_version": 1, + "id": "output", + "parameters": {}, + "type": "output" + } + ], + "recipe": "external_recipe", + "recipe_version": 1, + "revision": 1, + "schema_version": 1 + }, + "credential_revoked_after_qualification": true +} diff --git a/mcp_stdio.py b/mcp_stdio.py new file mode 100644 index 00000000..a6e06bf2 --- /dev/null +++ b/mcp_stdio.py @@ -0,0 +1,328 @@ +"""Optional tools-only MCP stdio bridge to the existing authenticated HTTP API. + +The SDK owns typed requests, sessions and results. This module owns a bounded +POSIX stdio transport and the explicitly narrower product protocol profile. +It never imports catalog/domain owners or retries an HTTP operation. +""" +import argparse +import json +import math +import os +import stat +import sys + +PROTOCOL_VERSION = '2025-06-18' +INPUT_LIMIT = 1024 * 1024 +OUTPUT_LIMIT = 32 * 1024 * 1024 +DEPTH_LIMIT = 64 +WRITE_SECONDS = 5 + + +class FrameError(ValueError): + """Public bounded framing error; never includes raw client input.""" + def __init__(self, message, code=-32700): + super().__init__(message) + self.code = code + + +def _pairs(pairs): + result = {} + for key, value in pairs: + if key in result: + raise FrameError('Duplicate JSON member') + result[key] = value + return result + + +def _constant(value): + raise FrameError('Nonfinite JSON number') + + +def parse_frame(raw): + """Decode one complete bounded object, before constructing SDK models.""" + if not isinstance(raw, bytes) or len(raw) > INPUT_LIMIT or not raw.endswith(b'\n'): + raise FrameError('Expected a complete JSON line within 1 MiB') + try: + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, + parse_constant=_constant) + pending = [(value, 0)] + while pending: + item, depth = pending.pop() + if depth > DEPTH_LIMIT: + raise FrameError('JSON nesting exceeds 64 levels') + if isinstance(item, dict): + pending.extend((v, depth + 1) for v in item.values()) + for key in item: + if '\x00' in key: + raise FrameError('NUL is not permitted in JSON text') + key.encode('utf-8') + elif isinstance(item, list): + pending.extend((v, depth + 1) for v in item) + elif isinstance(item, str): + if '\x00' in item: + raise FrameError('NUL is not permitted in JSON text') + item.encode('utf-8') + elif isinstance(item, float) and not math.isfinite(item): + raise FrameError('Nonfinite JSON number') + if not isinstance(value, dict): + raise FrameError('JSON-RPC batches and scalar messages are unsupported', -32600) + return value + except (UnicodeError, ValueError, RecursionError, OverflowError) as exc: + if isinstance(exc, FrameError): + raise + raise FrameError('Invalid UTF-8 JSON object') from None + + +def error_response(request_id, code, message): + return {'jsonrpc': '2.0', 'id': request_id, + 'error': {'code': code, 'message': message}} + + +def tool_error(code, message, status=502): + return {'status': status, 'result': {'code': code, 'error': message}} + + +def encode_response(value): + raw = json.dumps(value, ensure_ascii=False, allow_nan=False, + separators=(',', ':')).encode('utf-8') + b'\n' + if len(raw) > OUTPUT_LIMIT: + raise FrameError('Encoded MCP response exceeds 32 MiB') + return raw + + +class Profile: + """Only product restrictions; SDK still validates and handles each request.""" + def __init__(self, tool_names): + self.tool_names = frozenset(tool_names) + self.state = 'new' + self.pending = None + self.pending_method = None + + def accept(self, value): + """Return (forwarded message, direct error); ignore notifications as needed.""" + request_id = value.get('id') + has_id = 'id' in value + valid_id = (type(request_id) is int and abs(request_id) <= 2 ** 53 - 1 or + isinstance(request_id, str) and len(request_id) <= 128) + if value.get('jsonrpc') != '2.0' or (has_id and not valid_id): + return None, error_response(None, -32600, 'Invalid JSON-RPC request') + method = value.get('method') + if not isinstance(method, str) or not method or len(method) > 128: + return None, error_response(request_id if valid_id else None, -32600, + 'Invalid JSON-RPC method') + if set(value) - {'jsonrpc', 'id', 'method', 'params'}: + return None, error_response(request_id if valid_id else None, -32600, + 'Unexpected JSON-RPC member') + if not has_id: + # No request cancellation can roll back durable HTTP work. All unknown + # notifications, including cancellation, are ignored without a reply. + if method == 'notifications/initialized' and self.state == 'offered': + if value.get('params', {}) not in ({}, None): + return None, None + self.state = 'ready' + return value, None + return None, None + if self.pending is not None: + if request_id == self.pending: + return None, error_response(None, -32600, 'Request ID is already in use') + return None, error_response(request_id, -32000, 'Bridge busy; one request at a time') + if method not in ('initialize', 'ping', 'tools/list', 'tools/call'): + return None, error_response(request_id, -32601, 'Method not supported') + if method == 'initialize': + if self.state != 'new': + return None, error_response(request_id, -32600, 'Already initialized') + params = value.get('params') + if not isinstance(params, dict) or not isinstance(params.get('protocolVersion'), str): + return None, error_response(request_id, -32602, 'Invalid initialize parameters') + # Public stream-edge version selection: SDK returns our sole offered + # version, without changing SDK globals or private session methods. + value = dict(value, params=dict(params, protocolVersion=PROTOCOL_VERSION)) + elif method != 'ping' and self.state != 'ready': + return None, error_response(request_id, -32600, 'Initialization is incomplete') + params = value.get('params', {}) + if params is None or not isinstance(params, dict): + return None, error_response(request_id, -32602, 'Expected object parameters') + if method in ('tools/list', 'ping') and set(params) - {'_meta'}: + return None, error_response(request_id, -32602, 'Pagination and extra parameters unsupported') + if method == 'tools/call': + if (set(params) - {'name', 'arguments', '_meta'} or + not isinstance(params.get('name'), str) or params['name'] not in self.tool_names): + return None, error_response(request_id, -32602, 'Unknown tool or unsupported parameters') + if not isinstance(params.get('arguments', {}), dict): + return None, error_response(request_id, -32602, 'Tool arguments must be an object') + return value, None + + def admitted(self, value): + if 'id' in value: + self.pending, self.pending_method = value['id'], value['method'] + if self.pending_method == 'initialize': + self.state = 'initializing' + + def replied(self, value): + if self.pending is not None and value.get('id') == self.pending: + if self.pending_method == 'initialize': + self.state = 'offered' if 'result' in value else 'new' + self.pending = self.pending_method = None + + +async def serve(client, input_fd=0, output_fd=1): + """Run the public SDK over bounded stdio; caller bootstraps AgentClient first.""" + import anyio + from mcp import types + from mcp.server.lowlevel import Server + from mcp.server.models import InitializationOptions + from mcp.shared.message import SessionMessage + import agent_api + + agent_api.validate_registry() + definitions = agent_api.tool_definitions() + profile = Profile(item['name'] for item in definitions) + server = Server('tuldok', version='1') + + @server.list_tools() + async def list_tools(): + return [types.Tool.model_validate(item) for item in definitions] + + @server.call_tool(validate_input=False) + async def call_tool(name, arguments): + try: + agent_api.validate_arguments(name, arguments) + envelope = await anyio.to_thread.run_sync(client.call, name, arguments) + agent_api.validate_output(name, envelope) + except agent_api.AgentAPIError as exc: + # Owner supplies bounded, public API errors; no raw transport exception. + envelope = tool_error(exc.code, str(exc), exc.status) + except Exception: + envelope = tool_error('bridge_failure', 'Tool call failed; acknowledgement may be unknown') + return types.CallToolResult( + content=[types.TextContent(type='text', text=json.dumps(envelope, ensure_ascii=False, + allow_nan=False, separators=(',', ':')))], + structuredContent=envelope, isError=envelope['status'] >= 400) + + options = InitializationOptions(server_name='tuldok', server_version='1', + capabilities=types.ServerCapabilities(tools=types.ToolsCapability())) + incoming_send, incoming_receive = anyio.create_memory_object_stream(0) + outgoing_send, outgoing_receive = anyio.create_memory_object_stream(0) + output_lock = anyio.Lock() + regular_input = stat.S_ISREG(os.fstat(input_fd).st_mode) + regular_output = stat.S_ISREG(os.fstat(output_fd).st_mode) + old_input, old_output = os.get_blocking(input_fd), os.get_blocking(output_fd) + os.set_blocking(input_fd, False) + os.set_blocking(output_fd, False) + + async def write(value, sdk_response=False): + try: + raw = encode_response(value) + except (FrameError, UnicodeError, ValueError): + envelope = tool_error('response_too_large', 'Encoded response exceeds bridge limit') + value = {'jsonrpc': '2.0', 'id': value.get('id'), 'result': { + 'content': [{'type': 'text', 'text': json.dumps(envelope)}], + 'structuredContent': envelope, 'isError': True}} + raw = encode_response(value) + async with output_lock: + with anyio.fail_after(WRITE_SECONDS): + view = memoryview(raw) + while view: + if not regular_output: + await anyio.wait_writable(output_fd) + try: + count = os.write(output_fd, view) + except BlockingIOError: + continue + if count <= 0: + raise BrokenPipeError('Closed output') + view = view[count:] + if sdk_response: + profile.replied(value) + + async def reader(): + buffer = bytearray() + async with incoming_send: + while True: + if not regular_input: + await anyio.wait_readable(input_fd) + try: + block = os.read(input_fd, min(65536, INPUT_LIMIT + 1 - len(buffer))) + except BlockingIOError: + continue + if not block: + if buffer: + await write(error_response(None, -32700, 'Incomplete JSON line at EOF')) + return + buffer.extend(block) + while b'\n' in buffer: + newline = buffer.index(b'\n') + 1 + raw = bytes(buffer[:newline]) + del buffer[:newline] + try: + value = parse_frame(raw) + except FrameError as exc: + await write(error_response(None, exc.code, str(exc))) + continue + value, refusal = profile.accept(value) + if refusal is not None: + await write(refusal) + if value is None: + continue + try: + if 'id' in value: + types.ClientRequest.model_validate(value) + else: + types.ClientNotification.model_validate(value) + message = types.JSONRPCMessage.model_validate(value) + except ValueError: + await write(error_response(value.get('id'), -32602, 'Invalid method parameters')) + continue + if value.get('method') == 'tools/call': + params = value['params'] + try: + agent_api.validate_arguments(params['name'], params.get('arguments', {})) + except agent_api.AgentAPIError: + await write(error_response(value['id'], -32602, 'Invalid tool arguments')) + continue + profile.admitted(value) + await incoming_send.send(SessionMessage(message)) + if len(buffer) >= INPUT_LIMIT: + await write(error_response(None, -32700, 'Input line exceeds 1 MiB')) + return + + async def writer(): + async with outgoing_receive: + async for session_message in outgoing_receive: + value = session_message.message.model_dump(by_alias=True, exclude_none=True) + await write(value, sdk_response=True) + + try: + async with anyio.create_task_group() as group: + group.start_soon(reader) + group.start_soon(writer) + async with outgoing_send: + await server.run(incoming_receive, outgoing_send, options, raise_exceptions=True) + finally: + os.set_blocking(input_fd, old_input) + os.set_blocking(output_fd, old_output) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--config', required=True, help='Private AgentClient JSON configuration file') + args = parser.parse_args(argv) + try: + import anyio + import mcp # noqa: F401 - explicit optional consumer boundary + import jsonschema # noqa: F401 + import agent_api + client = agent_api.AgentClient.from_config(args.config) + client.bootstrap() + anyio.run(serve, client) + return 0 + except ImportError: + print('Optional agent dependencies unavailable; install the approved requirements-agent lock in a separate environment.', file=sys.stderr) + except (Exception, KeyboardInterrupt): + # No token, config, URL, request body, or raw exception reaches diagnostics. + print('Agent bridge stopped: configuration, authentication, transport or protocol failure.', file=sys.stderr) + return 1 + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/requirements-agent.lock b/requirements-agent.lock new file mode 100644 index 00000000..38c774b6 --- /dev/null +++ b/requirements-agent.lock @@ -0,0 +1,32 @@ +# Resolved 2026-10-13 with pip25.0.1, CPython3.12.14, Linux x86_64. +# Optional agent consumer only. Wheels only; hashes intentionally target this platform. +# See docs/plans/generic-scientific-projects/reports/p6-agent-dependencies.json. +annotated-types==0.8.0 --hash=sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0 +anyio==4.15.1 --hash=sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101 +attrs==26.1.0 --hash=sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309 +certifi==2026.7.22 --hash=sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775 +cffi==2.1.1 --hash=sha256:c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf +click==8.5.0 --hash=sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360 +cryptography==50.0.2 --hash=sha256:9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079 +h11==0.16.0 --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 +httpcore==1.0.9 --hash=sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55 +httpx==0.28.1 --hash=sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad +httpx-sse==0.4.3 --hash=sha256:0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc +idna==3.20 --hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c +jsonschema==4.26.0 --hash=sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce +jsonschema-specifications==2025.9.1 --hash=sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe +mcp==1.30.0 --hash=sha256:666edb5009503e1047c9d60346a756f94b261f05cc2625f23d41c728ffc484d0 +pycparser==3.11 --hash=sha256:51d5a8ba2be0bbe440b99d2112604c95bbbc3c2748a64260186c541e1729cd80 +pydantic==2.14.1 --hash=sha256:9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454 +pydantic-settings==2.15.0 --hash=sha256:0ba092c291c94baceb5eff768aa0d56400a457585bc0175925a5a5510303da42 +pydantic_core==2.50.1 --hash=sha256:93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e +PyJWT==2.15.1 --hash=sha256:42d59d631f7768a1028a64c7ff581a9bf7519804daf91fc5b6c56e30eec5e193 +python-dotenv==1.2.4 --hash=sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc +python-multipart==0.0.32 --hash=sha256:ff6d3f776f16878c894e52e107296ffc890e913c611b1a4ec6c44e2821fe2e23 +referencing==0.37.0 --hash=sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231 +rpds-py==2026.9.1 --hash=sha256:addeda51556dac7c1a2f14cda62db8b621cd12afba3091d03a96c72932387eab +sse-starlette==3.5.0 --hash=sha256:3e6e1070df3f0f5d9cea81496de92dbb72f6721871d99748ece67441dd8b7997 +starlette==1.8.0 --hash=sha256:dfdd6b29c26483288088d990eee59631dedadd66ce20d203402a7ca8e3c4656f +typing-inspection==0.4.4 --hash=sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147 +typing_extensions==4.16.0 --hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8 +uvicorn==0.54.0 --hash=sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf diff --git a/requirements-agent.txt b/requirements-agent.txt new file mode 100644 index 00000000..06f4f557 --- /dev/null +++ b/requirements-agent.txt @@ -0,0 +1,4 @@ +# Optional stdio agent bridge only; never app or scientific runtime dependencies. +# Full resolved hashes and consumer qualification are recorded separately. +mcp==1.30.0 +jsonschema==4.26.0 diff --git a/runs.py b/runs.py index 3603cffd..f67fabf5 100644 --- a/runs.py +++ b/runs.py @@ -36,6 +36,7 @@ TEST_FILES = {'test-metrics.json', 'predictions-test.json'} REQUEST_KEY = re.compile(r'^[A-Za-z0-9][A-Za-z0-9_.:-]{7,127}$') MAX_ARTIFACT_BYTES = 64 * 1024 * 1024 +MAX_ARTIFACT_SEGMENT_BYTES = 8 * 1024 * 1024 _DOWNLOAD_PERMIT = threading.BoundedSemaphore(1) @@ -1587,6 +1588,77 @@ def capture_artifact(self, run_id, name, expected_sha256, *, max_bytes=MAX_ARTIF 'custody_receipt_base64': base64.b64encode(receipt_raw).decode('ascii')} return raw, source + @authorized('inspect', 'runs.artifact_segment') + def artifact_segment(self, run_id, name, body): + """Read a bounded segment; only the client can verify the whole digest. + + This new, explicitly weaker read contract does not change artifact(), + open_artifact() or capture_artifact() and never spools/hashes all payloads. + Every call rechecks credentials and retained completed custody. + """ + closed(body, ('expected_sha256', 'offset', 'max_bytes')) + expected = body['expected_sha256'] + offset, maximum = body['offset'], body['max_bytes'] + if type(expected) is not str or not re.fullmatch(r'[a-f0-9]{64}', expected): + raise WorkbenchError('Supply the expected whole-artifact SHA256.') + if type(offset) is not int or offset < 0: + raise WorkbenchError('Artifact segment offset must be a nonnegative integer.') + if type(maximum) is not int or not 1 <= maximum <= MAX_ARTIFACT_SEGMENT_BYTES: + raise WorkbenchError('Artifact segment max_bytes must be 1 through 8 MiB.') + if type(name) is not str or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.-]{0,119}', name): + raise WorkbenchError('Artifact segment requires a declared flat output name.') + with self.lock: + run = self._load(run_id) + if not self._external(run): + raise WorkbenchError('Artifact segments support completed external Runs only.', 'unsupported', 400) + inventory = self._external_inventory(run) + item = next((item for item in inventory if item['name'] == name), None) + if item is None: + raise WorkbenchError('Unknown external artifact.', 'unavailable', 404) + if item['sha256'] != expected: + raise WorkbenchError('Artifact differs from the expected whole SHA256.', 'conflict', 409) + if offset > item['bytes']: + raise WorkbenchError('Artifact segment offset exceeds the artifact length.') + directory = descriptor = None + try: + directory = self._diagnostic_directory(self.path / run_id) + directory_identity = os.fstat(directory) + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=directory) + before = os.fstat(descriptor) + if (not stat.S_ISREG(before.st_mode) or before.st_uid != os.getuid() + or before.st_nlink != 1 or before.st_size != item['bytes']): + raise ValueError('Artifact segment source differs from declared inventory.') + count = min(maximum, item['bytes'] - offset) + raw = os.pread(descriptor, count, offset) + after = os.fstat(descriptor) + current = os.stat(name, dir_fd=directory, follow_symlinks=False) + keys = ('st_dev', 'st_ino', 'st_size', 'st_mtime_ns', 'st_ctime_ns', 'st_mode', 'st_uid', 'st_nlink') + if (len(raw) != count or any(getattr(before, key) != getattr(after, key) for key in keys) + or any(getattr(after, key) != getattr(current, key) for key in keys)): + raise ValueError('Artifact changed during segment read.') + current_directory = self._diagnostic_directory(self.path / run_id) + try: + current_identity = os.fstat(current_directory) + if (directory_identity.st_dev, directory_identity.st_ino) != (current_identity.st_dev, current_identity.st_ino): + raise ValueError('Artifact directory changed during segment read.') + finally: + os.close(current_directory) + except (OSError, ValueError) as error: + raise WorkbenchError('Artifact segment is unavailable or changed during read.', 'unavailable', 409) from error + finally: + if descriptor is not None: + os.close(descriptor) + if directory is not None: + os.close(directory) + next_offset = offset + len(raw) + return {'run_id':run_id, 'name':name, 'expected_sha256':expected, + 'total_bytes':item['bytes'], 'media_type':item['media_type'], + 'offset':offset, 'bytes':len(raw), 'next_offset':next_offset, + 'eof':next_offset == item['bytes'], + 'segment_sha256':hashlib.sha256(raw).hexdigest(), + 'data_base64':base64.b64encode(raw).decode('ascii'), + 'verification':'segment_read_whole_hash_unverified'} + @authorized('inspect', 'runs.artifact') def artifact(self, run_id, name): with self.lock: diff --git a/tests/qualify_agent_scientific.py b/tests/qualify_agent_scientific.py new file mode 100644 index 00000000..5f182055 --- /dev/null +++ b/tests/qualify_agent_scientific.py @@ -0,0 +1,203 @@ +"""Opt-in real official-SDK byte parity against already qualified scientific Runs. + +No model execution, graph editing, import, review, or scientific requalification. +Only explicit local QA-owner credential issuance/revocation changes authority. +All received artifact bytes are provisional until their complete hash matches the +prior authenticated HTTP inventory; bulk payloads are hashed and discarded. +""" +import argparse +import asyncio +import base64 +import hashlib +import json +import os +from pathlib import Path +import re +import subprocess +import sys +import tempfile +import time +import urllib.request + +ROOT = Path(__file__).resolve().parents[1] +SEGMENT = 8 * 1024 * 1024 + + +def private_file(path, raw): + descriptor = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) + with os.fdopen(descriptor, 'wb') as target: + target.write(raw) + + +def http(endpoint, route, cookie=None, body=None): + headers = {'Origin': endpoint} + if cookie: + headers['Cookie'] = cookie + if body is not None: + headers['Content-Type'] = 'application/json' + request = urllib.request.Request(endpoint + route, headers=headers, + data=None if body is None else json.dumps(body).encode()) + with urllib.request.urlopen(request, timeout=120) as response: + return json.load(response), response.headers + + +async def qualify(args, endpoint, credential, config, report): + from mcp import ClientSession, StdioServerParameters + from mcp.client.stdio import stdio_client + + previous = json.loads((args.evidence / 'receipt.json').read_text()) + expected_run = previous['run_id'] + expected_record = previous['record_id'] + inventory = {item['name']: item for item in json.loads( + (args.evidence / 'completed-http-inventory.json').read_text())} + project = json.loads((args.project / 'project.json').read_text()) + recipe = next(item for item in project['recipes'] if item['id'] == 'evaluate') + calls = [] + + async def call(session, name, arguments=None): + response = await session.call_tool(name.replace('.', '_'), arguments or {}) + envelope = response.structuredContent + assert isinstance(envelope, dict) and set(envelope) == {'status', 'result'}, name + assert json.loads(response.content[0].text) == envelope, name + assert envelope['status'] == 200 and not response.isError, name + calls.append({'operation': name, 'status': envelope['status']}) + return envelope['result'] + + parameters = StdioServerParameters(command=sys.executable, + args=[str(ROOT / 'mcp_stdio.py'), '--config', str(config)], cwd=str(ROOT)) + with (report / 'bridge-stderr.log').open('w+') as errors: + async with stdio_client(parameters, errlog=errors) as (reader, writer): + async with ClientSession(reader, writer) as session: + initialized = await session.initialize() + assert initialized.protocolVersion == '2025-06-18' + tools = await session.list_tools() + assert 'runs_artifact_chunk' in {tool.name for tool in tools.tools} + identity = await call(session, 'identity.get') + assert identity['kind'] == 'agent' and identity['scopes'] == ['inspect'] + assert identity['actor_id'] == credential['identity']['actor_id'] + context = await call(session, 'context.get') + projects = await call(session, 'projects.list') + inspected_project = await call(session, 'projects.get', {'project_id': project['id']}) + inspected_recipe = await call(session, 'recipes.inspect', {'project_id': project['id'], + 'reference_id': 'evaluate', 'expected_sha256': recipe['sha256']}) + before_runs = await call(session, 'runs.list') + before_graphs = await call(session, 'graphs.list') + before_record = await call(session, 'data.get', {'record_id': expected_record}) + run = await call(session, 'runs.get', {'run_id': expected_run}) + training = await call(session, 'runs.get', {'run_id': previous['source_training_run']}) + assert run['state'] == training['state'] == 'completed' + assert run['custody_phase'] == training['custody_phase'] == 'drained' + assert run['material_sha256'] == previous['material_sha256'] + graph = await call(session, 'graphs.get', {'graph_id': run['graph']['id']}) + progress = await call(session, 'runs.progress', {'run_id': expected_run}) + assert progress['evidence'] == 'custody_verified' + slice_value = await call(session, 'data.scientific', {'record_id': expected_record, + 'frame': 0, 'field': 'pressure', 'axis': 'z', 'index': 0}) + expected_slice = json.loads((args.evidence / 'representative-inspection.json').read_text()) + assert slice_value == expected_slice + transferred = [] + for name in ('input-model.pt', 'fields-learned-900-000.zip'): + expected = inventory[name] + artifact = next(item for item in run['artifacts'] if item['name'] == name) + assert (artifact['bytes'], artifact['sha256']) == (expected['bytes'], expected['sha256']) + digest, offset, segments = hashlib.sha256(), 0, [] + while offset < expected['bytes']: + part = await call(session, 'runs.artifact_chunk', {'run_id': expected_run, + 'name': name, 'expected_sha256': expected['sha256'], + 'offset': offset, 'max_bytes': SEGMENT}) + assert part['verification'] == 'segment_read_whole_hash_unverified' + assert (part['run_id'], part['name'], part['expected_sha256'], part['total_bytes']) == (expected_run, name, expected['sha256'], expected['bytes']) + raw = base64.b64decode(part['data_base64'], validate=True) + segment_sha = hashlib.sha256(raw).hexdigest() + assert part['segment_sha256'] == segment_sha + assert (part['offset'], part['bytes'], part['next_offset']) == (offset, len(raw), offset + len(raw)) + assert 0 < len(raw) <= SEGMENT + digest.update(raw) + segments.append({'offset': offset, 'bytes': len(raw), 'sha256': segment_sha}) + offset += len(raw) + assert part['eof'] == (offset == expected['bytes']) + assert offset == expected['bytes'] and digest.hexdigest() == expected['sha256'] + transferred.append({'name': name, 'bytes': offset, 'sha256': digest.hexdigest(), + 'segments': segments, 'verification': 'complete_reassembled_hash_matches_prior_HTTP'}) + print('Verified real MCP artifact:', name, offset, 'bytes', flush=True) + assert len(transferred[1]['segments']) > 1 + assert await call(session, 'runs.list') == before_runs + assert await call(session, 'graphs.list') == before_graphs + assert await call(session, 'data.get', {'record_id': expected_record}) == before_record + result = {'qualification': 'Actual official SDK stdio agent → authenticated HTTP → existing scientific owners; byte parity only', + 'new_model_execution': False, 'new_scientific_acceptance': False, + 'source_commit': subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(), + 'catalog_id': identity['catalog_id'], 'actor_id': identity['actor_id'], 'scopes': identity['scopes'], + 'protocol_version': initialized.protocolVersion, 'run_id': expected_run, + 'training_run_id': training['id'], 'record_id': expected_record, + 'run_and_graph_lists_unchanged': True, 'reviewed_record_exactly_unchanged': True, + 'typed_slice_exact_prior_HTTP_match': True, 'transferred_artifacts': transferred, + 'calls': calls, 'context': context, 'projects': projects, + 'project': inspected_project, 'recipe': inspected_recipe, 'graph': graph} + errors.seek(0) + assert credential['token'] not in errors.read() + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--catalog', type=Path, required=True) + parser.add_argument('--project', type=Path, required=True) + parser.add_argument('--evidence', type=Path, required=True) + parser.add_argument('--report', type=Path, required=True) + parser.add_argument('--app-python', default='/workspace/Tuldok/.venv/bin/python') + parser.add_argument('--qualification-admitted', action='store_true', required=True) + args = parser.parse_args() + args.catalog, args.project, args.evidence = (p.resolve() for p in (args.catalog, args.project, args.evidence)) + args.report.mkdir(parents=True, exist_ok=False) + with tempfile.TemporaryDirectory(prefix='tuldok-agent-scientific-private-') as private: + private = Path(private) + with (args.report / 'app.log').open('w+') as log: + server = subprocess.Popen([args.app_python, '-u', 'app.py', '--data', str(args.catalog), + '--port', '0', '--project-root', 'sample=' + str(args.project)], cwd=ROOT, + stdout=log, stderr=subprocess.STDOUT) + credential, cookie, endpoint = None, None, None + try: + deadline = time.monotonic() + 60 + while time.monotonic() < deadline: + log.flush() + match = re.search(r'127\.0\.0\.1:(\d+)', (args.report / 'app.log').read_text()) + if match: + endpoint = 'http://127.0.0.1:' + match[1] + break + assert server.poll() is None, 'Application exited before readiness' + time.sleep(.1) + assert endpoint, 'Application readiness timeout' + login = private / 'owner-login' + subprocess.run([args.app_python, 'access.py', 'login', '--data', str(args.catalog), + '--out', str(login)], cwd=ROOT, check=True, capture_output=True) + owner, headers = http(endpoint, '/api/access/session', body={'token': login.read_text().strip()}) + login.unlink() + cookie = headers['Set-Cookie'].split(';')[0] + credential, _ = http(endpoint, '/api/access/credentials', cookie, + {'label': 'P6 actual scientific read-only QA', 'scopes': ['inspect'], 'ttl_seconds': 3600}) + token_file, config = private / 'agent-token', private / 'config.json' + private_file(token_file, (credential['token'] + '\n').encode()) + private_file(config, json.dumps({'endpoint': endpoint, 'catalog_id': owner['catalog_id'], + 'token_file': str(token_file), 'timeout': 120}).encode()) + result = asyncio.run(qualify(args, endpoint, credential, config, args.report)) + result['credential_revoked_after_qualification'] = True + http(endpoint, '/api/access/credentials/' + credential['identity']['credential_id'] + '/revoke', cookie, {}) + credential = None + (args.report / 'receipt.json').write_text(json.dumps(result, indent=2) + '\n') + print('PASS actual scientific MCP byte parity:', args.report, flush=True) + finally: + try: + if credential is not None: + http(endpoint, '/api/access/credentials/' + credential['identity']['credential_id'] + '/revoke', cookie, {}) + finally: + server.terminate() + try: + server.wait(timeout=15) + except subprocess.TimeoutExpired: + server.kill() + server.wait(timeout=5) + + +if __name__ == '__main__': + main() diff --git a/tests/test_agent_api.py b/tests/test_agent_api.py new file mode 100644 index 00000000..8b0d5e34 --- /dev/null +++ b/tests/test_agent_api.py @@ -0,0 +1,307 @@ +"""Bounded registry/client tests; no model or external recipe execution.""" +import base64 +from contextlib import contextmanager +import hashlib +import importlib.util +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile +import threading +import time +import unittest +from unittest.mock import patch + +import agent_api as api + +HAS_JSONSCHEMA = importlib.util.find_spec('jsonschema') is not None + +TOKEN = 'test-agent-credential-abcdefghijklmnopqrstuvwxyz' +CATALOG = 'a' * 32 + + +def sample(schema): + if 'const' in schema: + return schema['const'] + if 'enum' in schema: + return schema['enum'][0] + if 'oneOf' in schema: + return sample(schema['oneOf'][0]) + kind = schema.get('type') + if kind == 'object': + return {key: sample(schema['properties'][key]) for key in schema.get('required', [])} + if kind == 'array': + return [sample(schema['items']) for _ in range(schema.get('minItems', 0))] + if kind in ('number', 'integer'): + return schema.get('minimum', schema.get('exclusiveMinimum', 0) + 1) + if kind == 'boolean': + return False + if kind == 'string': + pattern = schema.get('pattern', '') + if pattern == '^[a-f0-9]{32}$': return 'a'*32 + if pattern == '^[a-f0-9]{64}$': return 'a'*64 + if pattern.endswith('{8,128}$'): return 'request-key' + if pattern == '^[A-Za-z0-9+/]*={0,2}$': return 'YQ==' + return 'example' + return None + + +class RegistryTests(unittest.TestCase): + def test_discovery_is_stdlib_only_in_cold_process(self): + code = 'import sys;sys.path.insert(0,sys.argv[1]);import agent_api;agent_api.discovery();assert not any(x in sys.modules for x in ("jsonschema","app","workbench","mcp","psycopg"))' + subprocess.run([sys.executable, '-I', '-S', '-c', code, str(Path(api.__file__).parent)], check=True, capture_output=True, timeout=10) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_all_operation_schemas_and_route_projections(self): + api.validate_registry() + operations = api.discovery()['operations'] + self.assertEqual(len({op['mcp_name'] for op in operations}), len(operations)) + for op in operations: + with self.subTest(op=op['operation_id']): + args = sample(op['inputSchema']) + if op['operation_id'] == 'data.import_image': + args['image'] = 'YQ==' + method, path, body = api.project_request(op['mcp_name'], args) + self.assertEqual(method, op['method']) + self.assertNotIn('{', path) + self.assertTrue(path.startswith('/api/')) + self.assertEqual(body is None, method == 'GET') + with self.assertRaises(api.AgentAPIError): + api.validate_arguments(op['operation_id'], dict(args, unowned=True)) + value = api.discovery(); digest = value.pop('digest') + self.assertEqual(digest, hashlib.sha256(api.encoded(value)).hexdigest()) + value['operations'].clear() + self.assertTrue(api.discovery()['operations']) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_draft_tasks_and_no_human_or_programmatic_review(self): + for task, annotation in api.ANNOTATIONS.items(): + args = dict(record_id=CATALOG, revision=1, source_revision=1, task=task, + annotation=sample(annotation), groups=['family'], review='draft') + api.validate_arguments('data.save_draft', args) + for review in ('human_reviewed', 'programmatically_verified'): + with self.assertRaises(api.AgentAPIError): + api.validate_arguments('data.save_draft', dict(args, review=review)) + source = (Path(api.__file__).parent/'workbench.py').read_text() + for task in api.ANNOTATIONS: + self.assertIn(repr(task), source) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_integer_unicode_nonfinite_and_closed_subobjects(self): + for value in (True, -1): + with self.assertRaises(api.AgentAPIError): + api.validate_arguments('runs.artifact_chunk', dict(run_id=CATALOG, name='result.bin', expected_sha256='a'*64, offset=value, max_bytes=1)) + # Standard JSON Schema integer includes integral floats. Preserve the + # value for the stricter canonical owner rather than coerce it here. + projected = api.project_request('graphs.preflight_external', {'graph_id': CATALOG, 'revision': 1.0}) + self.assertIs(type(projected[2]['revision']), float) + for value in (float('nan'), '\ud800', '\x00'): + with self.assertRaises(api.AgentAPIError): + api.validate_arguments('data.query', {'q': value}) + with self.assertRaises(api.AgentAPIError): api.decode(b'{"a":1,"a":2}') + with self.assertRaises(api.AgentAPIError): api.decode(b'{"a":NaN}') + nested = None + for _ in range(api.DEPTH_LIMIT+2): nested = [nested] + with self.assertRaises(api.AgentAPIError): api._finite(nested) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_bindings_known_graph_drafts_and_no_executable_topology_requirement(self): + schema = api.operation('graphs.save')['inputSchema'] + body = sample(schema) + body['document']['edges'] = [] + api.validate_arguments('graphs.save', body) + body['document']['nodes'][0]['parameters']['shell'] = 'sh' + with self.assertRaises(api.AgentAPIError): api.validate_arguments('graphs.save', body) + create = dict(name='External', project_id=CATALOG, recipe_id='recipe', expected_sha256='a'*64, + inputs={'sample': {'kind': 'run_artifact', 'run_id': CATALOG, 'artifact_name': 'model.pt', 'expected_sha256': 'b'*64}}) + api.validate_arguments('graphs.create_external', create) + create['inputs']['sample']['path'] = '/tmp/unowned' + with self.assertRaises(api.AgentAPIError): api.validate_arguments('graphs.create_external', create) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_import_bytes_bound_is_aggregate(self): + raw = base64.b64encode(b'a'*(api.INLINE_LIMIT//2+1)).decode() + with self.assertRaises(api.AgentAPIError) as caught: + api.validate_arguments('data.import_mesh', {'files': {'mesh.ply': raw, 'mesh.json': raw}, 'groups': ['source']}) + self.assertEqual(caught.exception.code, 'too_large') + for keys in [('run.json', 'frames.jsonl'), ('run.json', 'frames.jsonl', 'controls.json')]: + api.validate_arguments('data.import_sequence', {'files': {k:'YQ==' for k in keys}, 'groups':['source']}) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_exposure_grant_and_projection(self): + self.assertEqual(api.project_request('runs.expose_test', {'run_id': CATALOG, 'reason': 'explicit disclosure'}), + ('POST', '/api/workspace/runs/'+CATALOG+'/expose-test', {'reason':'explicit disclosure'})) + self.assertEqual(api.operation('runs.expose_test')['scopes'], ['inspect','expose-holdout']) + for name in ('runs.retry', 'runs.approve_external', 'access.issue', 'data.review'): + with self.assertRaises(api.AgentAPIError): api.operation(name) + args = dict(request_key='test-request', graph_id=CATALOG, graph_revision=1, expected_digest='a'*64) + with self.assertRaises(api.AgentAPIError): api.validate_arguments('runs.submit_external', args) + args['approval_id'] = 'b'*32 + api.validate_arguments('runs.submit_external', args) + + +@contextmanager +def server(mode='normal'): + calls = [] + class Handler(BaseHTTPRequestHandler): + def log_message(self, *_args): pass + def do_POST(self): self.do_GET() + def do_GET(self): + calls.append((self.command, self.path, self.headers.get('Authorization'))) + if self.headers.get('Content-Length'): + self.rfile.read(int(self.headers['Content-Length'])) + if self.path == '/api/access/session': + value = {'kind': 'owner' if mode == 'owner' else 'agent', 'catalog_id': CATALOG, 'actor_id': CATALOG, 'scopes': ['inspect','edit']} + elif self.path == '/api/workspace/context': value = {'dataset_id': CATALOG} + elif self.path == '/api/agent/operations': + value = api.discovery() + if mode == 'mismatch': value['digest'] = '0'*64 + elif self.path.startswith('/api/workbench/records'): + value = {'items': [], 'total': 0, 'offset': 0, 'limit': 1} + elif self.path == '/api/workspace/projects': + value = {'id': CATALOG, 'manifest_sha256':'a'*64} + else: value = {'ok': True} + if mode == 'false_success' and self.command == 'POST': value = {'error': 'Not success'} + if mode == 'revoked' and self.path == '/api/agent/operations' and sum(path == self.path for _,path,_ in calls) > 1: + value = {'code':'unauthenticated','error':'Credential is revoked.'} + raw = json.dumps(value).encode() + if mode == 'trickle' and self.path.endswith('/records'): + try: + self.wfile.write(b'HTTP/1.1 200 OK\r\nX-Trickle: '); self.wfile.flush() + for _ in range(40): + self.wfile.write(b'x'); self.wfile.flush(); time.sleep(.02) + except OSError: pass + return + status = 307 if mode == 'redirect' else 503 if mode in ('unknown','code_echo') and self.command == 'POST' else 200 + if mode == 'revoked' and value.get('code') == 'unauthenticated': status = 401 + if status == 503: raw = json.dumps({'code':TOKEN if mode == 'code_echo' else 'commit_unknown','error':'Uncertain '+TOKEN}).encode() + self.send_response(status) + self.send_header('Content-Type', 'text/html' if mode == 'html' else 'application/json') + self.send_header('Content-Length', '9'*5000 if mode == 'huge_digits' else str(len(raw)+1 if mode == 'truncated' else api.RESPONSE_LIMIT+1 if mode == 'huge' else len(raw))) + if mode == 'duplicate': self.send_header('Content-Length', str(len(raw))) + if mode == 'compressed': self.send_header('Content-Encoding', 'gzip') + if mode == 'chunked': self.send_header('Transfer-Encoding', 'chunked') + self.end_headers() + self.wfile.write(raw) + httpd = ThreadingHTTPServer(('127.0.0.1', 0), Handler) + thread = threading.Thread(target=httpd.serve_forever, daemon=True); thread.start() + try: yield 'http://127.0.0.1:'+str(httpd.server_port), calls + finally: httpd.shutdown(); httpd.server_close(); thread.join(timeout=2) + + +class ClientTests(unittest.TestCase): + def test_fixed_endpoint_and_private_configuration(self): + for endpoint in ('https://127.0.0.1:1', 'http://localhost:1', 'http://127.0.0.2:1', 'http://127.0.0.1:1/x', 'http://user@127.0.0.1:1', 'http://127.0.0.1:1?x=1'): + with self.assertRaises(api.AgentAPIError): api.AgentClient(endpoint, TOKEN, CATALOG) + with tempfile.TemporaryDirectory() as directory: + path = Path(directory); token = path/'token'; config = path/'config' + token.write_text(TOKEN); token.chmod(0o600) + config.write_text(json.dumps({'endpoint':'http://127.0.0.1:1','catalog_id':CATALOG,'token_file':str(token)})); config.chmod(0o600) + api.AgentClient.from_config(config) + token.chmod(0o644) + with self.assertRaises(api.AgentAPIError): api.AgentClient.from_config(config) + token.unlink(); token.symlink_to(config) + with self.assertRaises(api.AgentAPIError): api.AgentClient.from_config(config) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_authenticated_discovery_proxy_ignored_and_one_mutation(self): + with server() as (endpoint, calls), patch.dict(os.environ, {'http_proxy':'http://bad.invalid:1', 'HTTP_PROXY':'http://bad.invalid:1'}): + client = api.AgentClient(endpoint, TOKEN, CATALOG) + self.assertEqual(client.call('data.query', {'limit':1})['status'], 200) + self.assertEqual(client.call('projects.open', {'root':'qa','manifest_path':'project.json'})['status'], 200) + self.assertEqual(sum(method=='POST' for method,_,_ in calls), 1) + self.assertEqual(sum(path=='/api/agent/operations' for _,path,_ in calls), 2) + self.assertTrue(all(auth=='Bearer '+TOKEN for _,_,auth in calls)) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_framing_identity_registry_refusals(self): + for mode in ('owner','mismatch','redirect','html','duplicate','compressed','chunked','truncated','huge','huge_digits'): + with self.subTest(mode=mode), server(mode) as (endpoint,calls): + with self.assertRaises(api.AgentAPIError) as caught: + api.AgentClient(endpoint,TOKEN,CATALOG).call('projects.open',{'root':'qa','manifest_path':'project.json'}) + self.assertNotIn(TOKEN, str(caught.exception)) + self.assertFalse(any(method=='POST' for method,_,_ in calls)) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_unknown_commit_is_not_retried_or_secret_echoed(self): + with server('unknown') as (endpoint,calls): + result = api.AgentClient(endpoint,TOKEN,CATALOG).call('projects.open',{'root':'qa','manifest_path':'project.json'}) + self.assertEqual(result['status'],503) + self.assertEqual(result['result']['code'],'commit_unknown') + self.assertNotIn(TOKEN,json.dumps(result)) + self.assertEqual(sum(method=='POST' for method,_,_ in calls),1) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_absolute_header_deadline_includes_trickle(self): + with server('trickle') as (endpoint,_calls): + client = api.AgentClient(endpoint,TOKEN,CATALOG,timeout=.15) + client.bootstrap() + start=time.monotonic() + with self.assertRaises(api.AgentAPIError): client.call('data.query',{}) + self.assertLess(time.monotonic()-start,1) + + +class OutputTests(unittest.TestCase): + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_typed_error_and_success_shapes(self): + for name in ('data.query', 'runs.list', 'projects.open', 'runs.artifact_chunk'): + with self.assertRaises(api.AgentAPIError): + api.validate_output(name, {'status':200,'result':{'error':'not success'}}) + api.validate_output(name, {'status':409,'result':{'error':'Domain refused','code':'conflict'}}) + with self.assertRaises(api.AgentAPIError): + api.validate_output('runs.list', {'status':200,'result':{}}) + for mode in ('false_success','code_echo'): + with server(mode) as (endpoint,calls): + with self.assertRaises(api.AgentAPIError) as caught: + api.AgentClient(endpoint,TOKEN,CATALOG).call('projects.open',{'root':'qa','manifest_path':'project.json'}) + self.assertNotIn(TOKEN,str(caught.exception)) + self.assertEqual(sum(method=='POST' for method,_,_ in calls),1) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_segment_reassembly_and_whole_hash_tamper(self): + original=b'whole original artifact' + expected=hashlib.sha256(original).hexdigest() + class Client: + payload=original + def call(self,name,args): + data=self.payload[args['offset']:args['offset']+args['max_bytes']] + value={k:args[k] for k in ('run_id','name','expected_sha256','offset')} + value.update(total_bytes=len(self.payload),media_type='application/octet-stream',bytes=len(data), + next_offset=args['offset']+len(data),eof=args['offset']+len(data)==len(self.payload), + data_base64=base64.b64encode(data).decode(),segment_sha256=hashlib.sha256(data).hexdigest(), + verification='segment_read_whole_hash_unverified') + envelope={'status':200,'result':value} + api.validate_output(name,envelope) + return envelope + client=Client();chunks=[] + result=api.verify_artifact(client,CATALOG,'result.bin',expected,consume=chunks.append,chunk_bytes=5) + self.assertEqual(b''.join(chunks),original) + self.assertEqual(result['verification'],'whole_sha256_verified') + client.payload=b'x'+original[1:] + with self.assertRaises(api.AgentAPIError) as caught: + api.verify_artifact(client,CATALOG,'result.bin',expected,chunk_bytes=5) + self.assertEqual(caught.exception.code,'artifact_mismatch') + + +class ParityRegressionTests(unittest.TestCase): + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_image_forwards_exact_raw_base64(self): + raw = base64.b64encode(b'original image bytes').decode() + _, _, body = api.project_request('data.import_image', {'image':raw,'groups':['source']}) + self.assertEqual(body, {'image':raw,'groups':['source'],'kind':'image'}) + with self.assertRaises(api.AgentAPIError): + api.validate_arguments('data.import_image', {'image':'data:image/png;base64,'+raw,'groups':['source']}) + + @unittest.skipUnless(HAS_JSONSCHEMA, 'Optional agent jsonschema dependency is not installed.') + def test_revoked_discovery_preserves_http_status_and_code_without_mutation(self): + with server('revoked') as (endpoint,calls): + client=api.AgentClient(endpoint,TOKEN,CATALOG) + client.bootstrap() + with self.assertRaises(api.AgentAPIError) as caught: + client.call('projects.open', {'root':'qa','manifest_path':'project.json'}) + self.assertEqual((caught.exception.status,caught.exception.code),(401,'unauthenticated')) + self.assertEqual(str(caught.exception),'Credential is revoked.') + self.assertFalse(any(method=='POST' for method,_,_ in calls)) diff --git a/tests/test_agent_domain_parity.py b/tests/test_agent_domain_parity.py new file mode 100644 index 00000000..457c60e2 --- /dev/null +++ b/tests/test_agent_domain_parity.py @@ -0,0 +1,246 @@ +"""Real agent HTTP parity over bounded authored data, never model acceptance. + +Every import/save traverses AgentClient and the authenticated HTTP/domain owner. +Only the explicit local owner bootstrap and immutable fixture construction are +local. Sequence fixtures are synthetic transport bytes, not producer evidence. +""" +import base64 +import hashlib +from http.server import ThreadingHTTPServer +import importlib.util +import io +import json +import os +from pathlib import Path +import tempfile +import threading +import time +import unittest +from urllib.error import HTTPError +from urllib.request import Request, urlopen +import uuid + +from PIL import Image +from app import Dataset, make_handler +from auth_helpers import ExplicitOwnerFixture +from fixtures.rheon_controls_authored import fixture as controls_fixture +from fixtures.rheon_source_derived import synthetic_frames, synthetic_manifest +from qualify_scientific_fields import neutral_bundle + +FIXTURES = Path(__file__).with_name('fixtures') + + +def b64(raw): + return base64.b64encode(raw).decode('ascii') + + +@unittest.skipUnless(importlib.util.find_spec('jsonschema'), + 'Requires the explicitly installed optional agent environment.') +class AgentDomainParityTests(unittest.TestCase): + def setUp(self): + import agent_api + directory = tempfile.TemporaryDirectory(prefix='agent-owner-parity-') + self.addCleanup(directory.cleanup) + self.path = Path(directory.name) + self.project = self.path / 'project' + self.project.mkdir() + self.dataset = Dataset(self.path / 'catalog', project_roots={'fixture': self.project}) + self.addCleanup(lambda: self.dataset.close()) + self.owner = ExplicitOwnerFixture.bootstrap(self.dataset) + self.server = ThreadingHTTPServer(('127.0.0.1', 0), make_handler(self.dataset)) + self.thread = threading.Thread(target=self.server.serve_forever, daemon=True) + self.thread.start() + self.addCleanup(self.stop_server) + self.endpoint = f'http://127.0.0.1:{self.server.server_port}' + credential = self.issue(['inspect', 'edit']) + self.agent = credential + self.client = agent_api.AgentClient(self.endpoint, credential['token'], self.owner.catalog_id) + self.client.bootstrap() + + def stop_server(self): + self.server.shutdown() + self.server.server_close() + self.thread.join(timeout=5) + + def http(self, path, body=None, *, token=None, binary=False, status=200): + request = Request(self.endpoint + path, + data=None if body is None else json.dumps(body).encode(), + headers={'Authorization': 'Bearer ' + (token or self.owner.token), + 'Content-Type': 'application/json'}) + try: + response = urlopen(request, timeout=30) + except HTTPError as error: + response = error + with response: + raw = response.read() + value = raw if binary else json.loads(raw) + self.assertEqual(response.status, status, value if not binary else raw[:200]) + return value + + def issue(self, scopes): + return self.http('/api/access/credentials', + {'label': 'Authored domain parity', 'scopes': scopes}, status=201) + + def call(self, operation, args, status=200, client=None): + result = (client or self.client).call(operation, args) + self.assertEqual(result['status'], status, {'operation': operation, 'result': result}) + return result['result'] + + def import_files(self, kind, members): + self.assertLessEqual(sum(map(len, members.values())), 512 * 1024) + return self.call('data.import_' + kind, + {'files': {name: b64(raw) for name, raw in members.items()}, + 'name': 'Authored ' + kind, 'groups': ['authored-' + kind], + 'rights': 'Bounded authored transport fixture; no scientific acceptance.'}, 201) + + def save_and_refuse_stale(self, record, task, annotation, expected): + before = self.http('/api/workbench/asset/' + record['id'], + token=self.agent['token'], binary=True) + body = {'record_id': record['id'], 'revision': record['revision'], + 'source_revision': record['source_revision'], 'groups': record['groups'], + 'task': task, 'annotation': annotation, 'review': 'draft'} + saved = self.call('data.save_draft', body) + self.assertEqual(saved['task'], task) + self.assertEqual(saved['annotation'], expected) + self.assertEqual(saved['review'], 'draft') + self.assertEqual(saved['revision'], record['revision'] + 1) + self.assertEqual(saved['source_revision'], record['source_revision']) + self.assertEqual(saved['content_hash'], record['content_hash']) + self.call('data.save_draft', body, 409) + current = dict(body, revision=saved['revision']) + self.call('data.save_draft', dict(current, source_revision=saved['source_revision'] + 1), 409) + if record['kind'] not in ('image', 'text'): + self.call('data.save_draft', dict(current, groups=['removed-protected-family']), 400) + self.assertEqual(self.call('data.get', {'record_id': record['id']}), saved) + after = self.http('/api/workbench/asset/' + record['id'], + token=self.agent['token'], binary=True) + self.assertEqual(after, before) + return saved + + def test_all_twelve_annotations_and_native_import_variants_reach_domain_owner(self): + seen = set() + stream = io.BytesIO() + Image.new('RGB', (16, 16), (20, 40, 160)).save(stream, 'PNG') + image = self.call('data.import_image', {'image': b64(stream.getvalue()), + 'groups': ['authored-image']}, 201) + boxes = {'boxes': [{'label': ' patch ', 'x': 1, 'y': 2, 'width': 3, 'height': 4}]} + expected_boxes = {'boxes': [dict(boxes['boxes'][0], label='patch')]} + for task, annotation, expected in [ + ('image_detection', boxes, expected_boxes), + ('image_classification', {'label': ' blue '}, {'label': 'blue'}), + ('image_caption', {'caption': ' Authored pixels '}, {'caption': 'Authored pixels'})]: + image = self.save_and_refuse_stale(image, task, annotation, expected) + seen.add(task) + text = self.call('data.import_text', {'text': 'Cafe\u0301 λ\r\n', 'groups': ['authored-text']}, 201) + self.assertEqual(text['text'], 'Café λ\n') + for task, annotation, expected in [ + ('text_classification', {'label': ' greeting '}, {'label': 'greeting'}), + ('text_entities', {'spans': [{'label': ' word ', 'start': 0, 'end': 4}]}, + {'spans': [{'label': 'word', 'start': 0, 'end': 4}]}), + ('text_corpus', {'note': ' Authored corpus '}, {'note': 'Authored corpus'})]: + text = self.save_and_refuse_stale(text, task, annotation, expected) + seen.add(task) + audio_raw = (FIXTURES / 'workspaces/audio/stereo-impulses.wav').read_bytes() + audio = self.call('data.import_audio', {'wav': b64(audio_raw), 'groups': ['authored-audio']}, 201) + segments = {'segments': [{'start_frame': 4000, 'end_frame': 8001, 'channel': 1, + 'transcript': '', 'label': 'impulse', 'speaker': ''}]} + audio = self.save_and_refuse_stale(audio, 'audio_timed', segments, segments) + seen.add('audio_timed') + self.assertEqual(self.call('data.audio', {'record_id': audio['id']})['id'], audio['id']) + native = [] + for kind, directory, stem, filenames in [ + ('mesh', 'meshes', 'tetrahedron', ('mesh.ply', 'mesh.json')), + ('pointcloud', 'pointclouds', 'ordered', ('points.ply', 'points.json')), + ('volume', 'volumes', 'oriented', ('volume.npy', 'volume.json'))]: + members = {name: (FIXTURES / directory / (stem + Path(name).suffix)).read_bytes() + for name in filenames} + native.append(self.import_files(kind, members)) + frames = b''.join(json.dumps(row, separators=(',', ':')).encode() + b'\n' + for row in synthetic_frames()) + native.append(self.import_files('sequence', + {'run.json': json.dumps(synthetic_manifest(frames)).encode(), 'frames.jsonl': frames})) + run, frames, controls = controls_fixture() + native.append(self.import_files('sequence', + {'run.json': run, 'frames.jsonl': frames, 'controls.json': controls})) + source = neutral_bundle() + (self.project / 'fields.zip').write_bytes(source) + manifest = {'schema_version': 1, 'id': uuid.uuid4().hex, 'name': 'Authored generic fields', + 'data': [{'id': 'fields', 'label': 'Authored fixture', 'path': 'fields.zip'}], + 'recipes': [], 'evidence': [], 'requirements': []} + (self.project / 'project.json').write_text(json.dumps(manifest)) + project = self.call('projects.open', {'root': 'fixture', 'manifest_path': 'project.json'}, 201) + native.append(self.call('data.import_project_scientific', + {'project_id': project['id'], 'reference_id': 'fields', + 'expected_sha256': hashlib.sha256(source).hexdigest(), 'groups': ['authored-fields']}, 201)) + tasks = {'mesh': 'mesh_geometry', 'pointcloud': 'pointcloud_geometry', 'volume': 'volume_grid', + 'sequence': 'sequence_transport', 'field_sequence': 'field_sequence_fields'} + for record in native: + task = tasks[record['kind']] + with self.subTest(kind=record['kind'], id=record['id']): + saved = self.save_and_refuse_stale(record, task, + {'note': ' Inspected authored source '}, {'note': 'Inspected authored source'}) + seen.add(task) + operation = {'field_sequence': 'scientific'}.get(record['kind'], record['kind']) + if operation != 'sequence': + projection = self.call('data.' + operation, {'record_id': saved['id']}) + self.assertEqual(projection['id'], saved['id']) + self.assertEqual(seen, {'image_detection', 'image_classification', 'image_caption', + 'text_classification', 'text_entities', 'text_corpus', 'audio_timed', 'mesh_geometry', + 'pointcloud_geometry', 'volume_grid', 'sequence_transport', 'field_sequence_fields'}) + + @unittest.skipUnless(os.environ.get('TULDOK_TRAINING_PYTHON'), + 'Requires an explicitly selected real classifier runtime.') + def test_scoped_agent_exposes_actual_completed_authored_classifier_holdout(self): + import agent_api + rows = [] + for index in range(18): + label = 'schedule' if index % 2 else 'cancel' + text = ('Arrange meeting schedule tomorrow' if index % 2 else 'Cancel appointment reservation tomorrow') + row = self.call('data.import_text', {'text': text + f' authoredmarker{index}', + 'groups': [f'independent-text-{index}']}, 201) + rows.append(self.http('/api/workbench/records/' + row['id'], + {'revision': row['revision'], 'source_revision': row['source_revision'], + 'task': 'text_classification', 'annotation': {'label': label}, + 'groups': row['groups'], 'review': 'human_reviewed'})) + body = {'format': 'text_classification_v1', + 'items': [{key: row[key] for key in ('id', 'revision', 'source_revision')} for row in rows], + 'ratios': {'train': 50, 'validation': 25, 'test': 25}, 'seed': 42} + for seed in range(42, 100): + body['seed'] = seed + preview = self.http('/api/workbench/releases/preview', body) + if preview['eligible']: + break + self.assertTrue(preview['eligible'], preview['blockers']) + release = self.http('/api/workbench/releases', dict(body, preview_token=preview['preview_token']), status=201) + graph = self.http('/api/workspace/graphs', {'name': 'Authored holdout transport', + 'recipe': 'text_classification', 'release_id': release['id']}, status=201) + validation = self.http('/api/workspace/graphs/' + graph['id'] + '/validate', {'revision': graph['revision']}) + self.assertTrue(validation['valid'], validation) + run = self.http('/api/workspace/runs', {'request_key': 'parity-' + uuid.uuid4().hex, + 'graph_id': graph['id'], 'graph_revision': graph['revision'], + 'validation_token': validation['validation_token']}, status=201) + deadline = time.monotonic() + 60 + while time.monotonic() < deadline: + result = self.call('runs.get', {'run_id': run['id']}) + if result['state'] in ('completed', 'failed', 'unknown', 'interrupted'): + break + time.sleep(.05) + self.assertEqual(result['state'], 'completed', {key: result.get(key) for key in ('id', 'state', 'error')}) + self.assertFalse(result['test_exposure']['exposed']) + self.call('runs.expose_test', {'run_id': run['id'], 'reason': 'Authored holdout transport check'}, 403) + self.http('/api/workspace/runs/' + run['id'] + '/predictions?split=test', + token=self.agent['token'], status=409) + credential = self.issue(['inspect', 'expose-holdout']) + scoped = agent_api.AgentClient(self.endpoint, credential['token'], self.owner.catalog_id) + scoped.bootstrap() + event = self.call('runs.expose_test', {'run_id': run['id'], + 'reason': 'Explicit authored classifier holdout inspection; no model quality claim.'}, client=scoped) + self.assertTrue(event['test_exposure']['exposed']) + predictions = self.http('/api/workspace/runs/' + run['id'] + '/predictions?split=test', token=credential['token']) + self.assertGreater(len(predictions['rows']), 0) + self.http('/api/access/credentials/' + credential['identity']['credential_id'] + '/revoke', {}) + self.call('runs.get', {'run_id': run['id']}, 401, client=scoped) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_agent_http.py b/tests/test_agent_http.py new file mode 100644 index 00000000..9959a4a0 --- /dev/null +++ b/tests/test_agent_http.py @@ -0,0 +1,158 @@ +"""Authenticated public discovery and bounded artifact HTTP integration. + +Neutral fixture execution proves process/byte custody, never model acceptance. +No authentication injection or production owner mutation is mocked. +""" +import base64 +import hashlib +from http.server import ThreadingHTTPServer +import json +import threading +import time +from urllib.error import HTTPError +from urllib.request import Request, urlopen + +from app import Dataset, make_handler +from test_external_runs import ExternalCase + + +class AgentHTTPCase(ExternalCase): + """Shared real server fixture; contains no test methods of its own.""" + def setUp(self): + super().setUp() + self.server = None + self.start_server() + self.addCleanup(self.stop_server) + + def start_server(self): + self.server = ThreadingHTTPServer(('127.0.0.1', 0), make_handler(self.dataset)) + self.server_thread = threading.Thread(target=self.server.serve_forever, daemon=True) + self.server_thread.start() + self.root = f'http://127.0.0.1:{self.server.server_port}' + + def stop_server(self): + if self.server is not None: + self.server.shutdown() + self.server.server_close() + self.server_thread.join(timeout=5) + self.server = None + + def reopen_http(self): + self.stop_server() + self.dataset.close() + self.dataset = Dataset(self.path / 'catalog', project_roots={'fixture': self.project_path}) + self.start_server() + + def http(self, path, body=None, token=None, *, binary=False, headers=None): + headers = {'Content-Type': 'application/json', **(headers or {})} + if token is not None: + headers['Authorization'] = 'Bearer ' + token + request = Request(self.root + path, data=None if body is None else json.dumps(body).encode(), + headers=headers) + try: + response = urlopen(request, timeout=20) + except HTTPError as error: + response = error + with response: + raw = response.read() + return response.status, raw if binary else json.loads(raw) + + def issue_http(self, scopes): + status, value = self.http('/api/access/credentials', + {'label': 'Explicit agent integration fixture', 'scopes': scopes}, + self.owner.token) + self.assertEqual(status, 201, value) + return value + + def complete_http(self): + approval_body = {'graph_id': self.graph['id'], 'graph_revision': self.graph['revision'], + 'expected_digest': self.preflight['material_sha256'], + 'consumer_actor_id': self.agent['identity']['actor_id']} + status, approval = self.http('/api/workspace/runs/approve-external', approval_body, self.owner.token) + self.assertEqual(status, 201, approval) + status, run = self.http('/api/workspace/runs/submit-external', + self.body(approval=approval), self.agent['token']) + self.assertEqual(status, 201, run) + deadline = time.monotonic() + 40 + while time.monotonic() < deadline: + status, run = self.http('/api/workspace/runs/' + run['id'], token=self.agent['token']) + self.assertEqual(status, 200, run) + if run['state'] in ('completed', 'failed', 'cancelled', 'unknown', 'interrupted'): + break + time.sleep(.05) + self.assertEqual(run['state'], 'completed', {key: run.get(key) for key in ('id', 'state', 'error')}) + self.assertEqual(run['custody_phase'], 'drained') + return run + + +class AgentHTTPTests(AgentHTTPCase): + def test_discovery_is_authenticated_canonical_and_secret_free(self): + import agent_api + path = '/api/agent/operations' + self.assertEqual(self.http(path)[0], 401) + status, _ = self.http('/api/access/credentials', + {'label': 'Invalid missing inspect', 'scopes': ['edit']}, self.owner.token) + self.assertEqual(status, 400) # Production issuance never admits a no-inspect agent. + status, discovery = self.http(path, token=self.agent['token']) + self.assertEqual(status, 200, discovery) + self.assertEqual(discovery, agent_api.discovery()) + serialized = json.dumps(discovery) + for credential in (self.owner.token, self.agent['token']): + self.assertNotIn(credential, serialized) + status, _ = self.http('/api/access/credentials/' + self.agent['identity']['credential_id'] + '/revoke', + {}, self.owner.token) + self.assertEqual(status, 200) + self.assertEqual(self.http(path, token=self.agent['token'])[0], 401) + + def test_real_segment_reconstruction_bounds_restart_and_revocation(self): + run = self.complete_http() + artifact = next(item for item in run['artifacts'] if item['name'] == 'result.txt') + route = '/api/workspace/runs/' + run['id'] + '/artifact-segment/result.txt' + body = {'expected_sha256': artifact['sha256'], 'offset': 0, 'max_bytes': 7} + self.assertEqual(self.http(route, body)[0], 401) + chunks, offset = [], 0 + while True: + status, part = self.http(route, dict(body, offset=offset), self.agent['token']) + self.assertEqual(status, 200, part) + self.assertEqual(part['verification'], 'segment_read_whole_hash_unverified') + self.assertEqual((part['run_id'], part['name'], part['offset']), (run['id'], 'result.txt', offset)) + raw = base64.b64decode(part['data_base64'], validate=True) + self.assertEqual(part['segment_sha256'], hashlib.sha256(raw).hexdigest()) + self.assertEqual((part['bytes'], part['next_offset']), (len(raw), offset + len(raw))) + self.assertEqual(part['total_bytes'], len(self.input)) + chunks.append(raw) + offset = part['next_offset'] + if part['eof']: + break + self.assertGreater(len(raw), 0) + assembled = b''.join(chunks) + self.assertEqual(assembled, self.input) + self.assertEqual(hashlib.sha256(assembled).hexdigest(), artifact['sha256']) + for changed in (dict(body, offset=True), dict(body, offset=-1), + dict(body, offset=len(self.input) + 1), dict(body, max_bytes=0), + dict(body, max_bytes=8 * 1024 * 1024 + 1), dict(body, extra='not allowed')): + with self.subTest(changed=changed): + self.assertEqual(self.http(route, changed, self.agent['token'])[0], 400) + self.assertEqual(self.http(route, dict(body, expected_sha256='0' * 64), self.agent['token'])[0], 409) + status, end = self.http(route, dict(body, offset=len(self.input)), self.agent['token']) + self.assertEqual(status, 200, end) + self.assertEqual((end['bytes'], end['data_base64'], end['eof']), (0, '', True)) + self.reopen_http() + status, again = self.http(route, body, self.agent['token']) + self.assertEqual(status, 200, again) + self.assertEqual(base64.b64decode(again['data_base64']), self.input[:7]) + self.assertEqual(self.http('/api/access/credentials/' + self.agent['identity']['credential_id'] + '/revoke', + {}, self.owner.token)[0], 200) + self.assertEqual(self.http(route, dict(body, offset=7), self.agent['token'])[0], 401) + + def test_holdout_scope_does_not_invent_external_classification_results(self): + run = self.complete_http() + path = '/api/workspace/runs/' + run['id'] + '/expose-test' + self.assertEqual(self.http(path, {'reason': 'Explicit fixture scope check'}, self.agent['token'])[0], 403) + scoped = self.issue_http(['inspect', 'expose-holdout']) + status, error = self.http(path, {'reason': 'Explicit fixture scope check'}, scoped['token']) + self.assertEqual((status, error['code']), (409, 'unsupported')) + status, after = self.http('/api/workspace/runs/' + run['id'], token=scoped['token']) + self.assertEqual(status, 200, after) + self.assertEqual(after['state'], 'completed') + self.assertNotIn('test_exposure', after) diff --git a/tests/test_agent_workflow.py b/tests/test_agent_workflow.py new file mode 100644 index 00000000..1d01fbc1 --- /dev/null +++ b/tests/test_agent_workflow.py @@ -0,0 +1,230 @@ +"""Real official-SDK stdio client → authenticated HTTP → durable domain workflow. + +Run this gate with the optional pinned agent dependencies installed explicitly. +Base environments without that optional capability report a skip, not acceptance. +The subprocess is the production bridge; the executable is the neutral byte-copy +fixture. No model, scientific metric, mocked queue or synthetic completion claim. +""" +import asyncio +import base64 +import copy +from contextlib import asynccontextmanager +import hashlib +import importlib.util +import io +import json +import os +from pathlib import Path +import sys +import time +import unittest +import uuid +import zipfile + +from test_agent_http import AgentHTTPCase + +ROOT = Path(__file__).resolve().parents[1] +SDK_AVAILABLE = importlib.util.find_spec('mcp') is not None and importlib.util.find_spec('jsonschema') is not None + + +def private_file(path, raw): + descriptor = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) + with os.fdopen(descriptor, 'wb') as target: + target.write(raw) + + +@unittest.skipUnless(SDK_AVAILABLE, 'Optional pinned MCP/jsonschema environment required; not workflow acceptance') +class AgentWorkflowTests(AgentHTTPCase): + def setUp(self): + super().setUp() + # Same neutral executable; larger bounded input admits an actual canonical + # text release rather than pretending that an arbitrary blob is reviewed. + self.definition['inputs']['sample']['max_bytes'] = 128 * 1024 + self.definition['outputs'][0]['max_bytes'] = 128 * 1024 + self.definition['resources']['max_output_bytes'] = 256 * 1024 + self.definition_raw = json.dumps(self.definition).encode() + self.manifest['id'] = uuid.uuid4().hex + self.manifest['recipes'][0]['sha256'] = hashlib.sha256(self.definition_raw).hexdigest() + (self.project_path / 'recipe.json').write_bytes(self.definition_raw) + (self.project_path / 'project.json').write_text(json.dumps(self.manifest)) + self.editor = self.issue_http(['inspect', 'edit', 'freeze', 'execute', 'cancel']) + self.config_count = 0 + + @asynccontextmanager + async def mcp(self, credential): + from mcp import ClientSession, StdioServerParameters + from mcp.client.stdio import stdio_client + self.config_count += 1 + token_file = self.path / f'agent-token-{self.config_count}' + config_file = self.path / f'agent-config-{self.config_count}.json' + private_file(token_file, (credential['token'] + '\n').encode('ascii')) + private_file(config_file, json.dumps({'endpoint': self.root, 'catalog_id': self.owner.catalog_id, + 'token_file': str(token_file), 'timeout': 30}).encode()) + parameters = StdioServerParameters(command=sys.executable, + args=[str(ROOT / 'mcp_stdio.py'), '--config', str(config_file)], cwd=str(ROOT)) + log = self.path / f'agent-stderr-{self.config_count}.log' + with log.open('w+') as errors: + async with stdio_client(parameters, errlog=errors) as (reader, writer): + async with ClientSession(reader, writer) as session: + initialized = await session.initialize() + self.assertEqual(initialized.protocolVersion, '2025-06-18') + self.assertIsNotNone(initialized.capabilities.tools) + self.assertIsNone(initialized.capabilities.resources) + self.assertIsNone(initialized.capabilities.prompts) + yield session + errors.seek(0) + self.assertNotIn(credential['token'], errors.read()) + + async def tool(self, session, operation, arguments=None, status=200): + response = await session.call_tool(operation.replace('.', '_'), arguments or {}) + envelope = response.structuredContent + self.assertIsInstance(envelope, dict, operation + ' must preserve the typed status/result envelope') + self.assertEqual(set(envelope), {'status', 'result'}) + self.assertEqual(json.loads(response.content[0].text), envelope) + self.assertEqual(envelope['status'], status, {'operation': operation, 'response': envelope}) + self.assertEqual(response.isError, status >= 400) + return envelope['result'] + + async def invalid_tool(self, session, operation, arguments): + from mcp.shared.exceptions import McpError + with self.assertRaises(McpError) as refused: + await session.call_tool(operation.replace('.', '_'), arguments) + self.assertEqual(refused.exception.error.code, -32602) + + async def terminal(self, session, run_id, wanted='completed'): + deadline = time.monotonic() + 45 + while time.monotonic() < deadline: + run = await self.tool(session, 'runs.get', {'run_id': run_id}) + if run['state'] in ('completed', 'failed', 'cancelled', 'unknown', 'interrupted'): + self.assertEqual(run['state'], wanted, {key: run.get(key) for key in ('id', 'state', 'error')}) + self.assertEqual(run['custody_phase'], 'drained') + return run + await asyncio.sleep(.05) + self.fail('Neutral agent Run did not reach the required terminal state: ' + run_id) + + async def artifact(self, session, run): + item = next(item for item in run['artifacts'] if item['name'] == 'result.txt') + pieces, offset = [], 0 + while True: + part = await self.tool(session, 'runs.artifact_chunk', {'run_id': run['id'], 'name': item['name'], + 'expected_sha256': item['sha256'], 'offset': offset, 'max_bytes': 257}) + self.assertEqual(part['verification'], 'segment_read_whole_hash_unverified') + raw = base64.b64decode(part['data_base64'], validate=True) + self.assertEqual(hashlib.sha256(raw).hexdigest(), part['segment_sha256']) + self.assertEqual((part['offset'], part['bytes'], part['next_offset']), (offset, len(raw), offset + len(raw))) + pieces.append(raw) + offset = part['next_offset'] + if part['eof']: + break + self.assertGreater(len(raw), 0) + raw = b''.join(pieces) + self.assertEqual(len(raw), item['bytes']) + self.assertEqual(hashlib.sha256(raw).hexdigest(), item['sha256']) + return raw + + def approve_http(self, graph, preflight, actor): + status, approval = self.http('/api/workspace/runs/approve-external', + {'graph_id': graph['id'], 'graph_revision': graph['revision'], + 'expected_digest': preflight['material_sha256'], 'consumer_actor_id': actor}, self.owner.token) + self.assertEqual(status, 201, approval) + return approval + + def test_real_agent_draft_owner_review_freeze_approval_replay_restart_and_revocation(self): + asyncio.run(self.workflow()) + + async def workflow(self): + async with self.mcp(self.editor) as session: + tools = await session.list_tools() + names = {item.name for item in tools.tools} + for required in ('data_save_draft', 'releases_freeze', 'graphs_preflight_external', + 'runs_submit_external', 'runs_artifact_chunk', 'runs_expose_test'): + self.assertIn(required, names) + for forbidden in ('runs_approve_external', 'credentials_issue', 'data_approve_review', 'runs_retry'): + self.assertNotIn(forbidden, names) + identity = await self.tool(session, 'identity.get') + self.assertEqual((identity['kind'], identity['actor_id']), ('agent', self.editor['identity']['actor_id'])) + project = await self.tool(session, 'projects.open', {'root': 'fixture', 'manifest_path': 'project.json'}, 201) + self.assertEqual(project['id'], self.manifest['id']) + recipe = await self.tool(session, 'recipes.inspect', {'project_id': project['id'], + 'reference_id': 'neutral', 'expected_sha256': hashlib.sha256(self.definition_raw).hexdigest()}) + self.assertEqual(recipe['definition']['id'], 'neutral') + record = await self.tool(session, 'data.import_text', {'text': 'Neutral reviewed text: λ\n', + 'name': 'Agent-authored fixture', 'rights': 'Authored QA fixture', 'groups': ['p6-independent-source']}, 201) + draft = {'record_id': record['id'], 'revision': record['revision'], 'source_revision': record['source_revision'], + 'task': 'text_classification', 'annotation': {'label': ' neutral '}, 'groups': record['groups'], 'review': 'draft'} + await self.invalid_tool(session, 'data.save_draft', dict(draft, review='human_reviewed')) + http_draft = {key: value for key, value in draft.items() if key != 'record_id'} + self.assertEqual(self.http('/api/workbench/records/' + record['id'], + dict(http_draft, review='human_reviewed'), self.editor['token'])[0], 403) + saved = await self.tool(session, 'data.save_draft', draft) + self.assertEqual((saved['review'], saved['annotation']), ('draft', {'label': 'neutral'})) + await self.tool(session, 'data.save_draft', draft, 409) + selection = {'format': 'canonical_v1', 'items': [{key: saved[key] for key in ('id', 'revision', 'source_revision')}], + 'ratios': {'train': 100, 'validation': 0, 'test': 0}, 'seed': 42} + blocked = await self.tool(session, 'releases.preview', selection) + self.assertFalse(blocked['eligible']) + self.assertTrue(blocked['blockers']) + owner_review = dict(http_draft, revision=saved['revision'], annotation=saved['annotation'], review='human_reviewed') + status, reviewed = self.http('/api/workbench/records/' + record['id'], owner_review, self.owner.token) + self.assertEqual(status, 200, reviewed) + selection['items'][0]['revision'] = reviewed['revision'] + preview = await self.tool(session, 'releases.preview', selection) + self.assertTrue(preview['eligible'], preview) + await self.tool(session, 'releases.freeze', dict(selection, preview_token='0' * 64), 409) + release = await self.tool(session, 'releases.freeze', dict(selection, preview_token=preview['preview_token']), 201) + status, archive = self.http(release['url'], token=self.owner.token, binary=True) + self.assertEqual(status, 200) + self.assertEqual(hashlib.sha256(archive).hexdigest(), release['id']) + with zipfile.ZipFile(io.BytesIO(archive)) as package: + frozen = json.loads(package.read('manifest.json')) + self.assertEqual(frozen['records'][0]['annotation'], {'label': 'neutral'}) + self.assertEqual(frozen['records'][0]['review'], 'human_reviewed') + graph = await self.tool(session, 'graphs.create_external', {'name': 'Neutral frozen bytes through agent', + 'project_id': project['id'], 'recipe_id': 'neutral', 'expected_sha256': hashlib.sha256(self.definition_raw).hexdigest(), + 'inputs': {'sample': {'kind': 'frozen_release', 'release_id': release['id'], 'expected_sha256': release['id']}}}, 201) + changed = copy.deepcopy(graph) + changed['name'] = 'Edited exact agent graph' + graph = await self.tool(session, 'graphs.save', {'graph_id': graph['id'], 'revision': graph['revision'], 'document': changed}) + await self.tool(session, 'graphs.save', {'graph_id': graph['id'], 'revision': changed['revision'], 'document': changed}, 409) + await self.tool(session, 'graphs.preflight_external', {'graph_id': graph['id'], 'revision': changed['revision']}, 409) + preflight = await self.tool(session, 'graphs.preflight_external', {'graph_id': graph['id'], 'revision': graph['revision']}) + self.assertTrue(preflight['valid']) + grant = self.approve_http(graph, preflight, self.editor['identity']['actor_id']) + submission = {'graph_id': graph['id'], 'graph_revision': graph['revision'], 'expected_digest': preflight['material_sha256'], + 'request_key': 'p6-neutral-' + uuid.uuid4().hex, 'approval_id': grant['id']} + await self.invalid_tool(session, 'runs.submit_external', {key: value for key, value in submission.items() if key != 'approval_id'}) + self.assertEqual(self.http('/api/workspace/runs/approve-external', {}, self.editor['token'])[0], 403) + self.assertEqual(self.http('/api/workspace/runs', {}, self.editor['token'])[0], 403) + admitted = await self.tool(session, 'runs.submit_external', submission, 201) + replay = await self.tool(session, 'runs.submit_external', submission, 201) + self.assertEqual(replay['id'], admitted['id']) + await self.tool(session, 'runs.submit_external', dict(submission, request_key='p6-reused-grant-' + uuid.uuid4().hex), 409) + completed = await self.terminal(session, admitted['id']) + self.assertEqual(await self.artifact(session, completed), archive) + progress = await self.tool(session, 'runs.progress', {'run_id': completed['id']}) + self.assertEqual(progress['evidence'], 'custody_verified') + await self.tool(session, 'runs.expose_test', {'run_id': completed['id'], 'reason': 'No exposure scope'}, 403) + fresh_grant = self.approve_http(graph, preflight, self.editor['identity']['actor_id']) + fresh_submission = dict(submission, request_key='p6-explicit-fresh-' + uuid.uuid4().hex, approval_id=fresh_grant['id']) + fresh = await self.tool(session, 'runs.submit_external', fresh_submission, 201) + self.assertNotEqual(fresh['id'], completed['id']) + self.assertEqual(await self.artifact(session, await self.terminal(session, fresh['id'])), archive) + all_runs = await self.tool(session, 'runs.list') + self.assertEqual({run['id'] for run in all_runs}, {completed['id'], fresh['id']}) + # Disconnect is not a retry or revocation; restart the actual HTTP owner + # and reconnect a new production stdio process using retained identity. + self.reopen_http() + async with self.mcp(self.editor) as session: + replay = await self.tool(session, 'runs.submit_external', submission, 201) + self.assertEqual(replay['id'], completed['id']) + self.assertEqual(await self.artifact(session, replay), archive) + status, _ = self.http('/api/access/credentials/' + self.editor['identity']['credential_id'] + '/revoke', + {}, self.owner.token) + self.assertEqual(status, 200) + await self.tool(session, 'runs.get', {'run_id': completed['id']}, 401) + await self.tool(session, 'runs.submit_external', submission, 401) + scoped = self.issue_http(['inspect', 'expose-holdout']) + async with self.mcp(scoped) as session: + refusal = await self.tool(session, 'runs.expose_test', + {'run_id': completed['id'], 'reason': 'Explicitly scoped request; neutral external has no classifier holdout'}, 409) + self.assertEqual(refusal['code'], 'unsupported') diff --git a/tests/test_artifact_segments.py b/tests/test_artifact_segments.py new file mode 100644 index 00000000..a190fab9 --- /dev/null +++ b/tests/test_artifact_segments.py @@ -0,0 +1,163 @@ +"""Stateless segment contract; authored neutral processes, no model qualification. + +These tests are authored during P6 source preparation. Execution is deferred +until the integration owner releases the active numerical benchmark gate. +""" +import base64 +import hashlib +import json +import os +import uuid +from unittest.mock import patch + +from access import AccessError +from test_external_runs import ExternalCase +from workbench import WorkbenchError + + +class ArtifactSegmentTests(ExternalCase): + def complete(self, *, empty=False): + if empty: + source = b'import pathlib,sys\npathlib.Path(sys.argv[3],"result.txt").write_bytes(b"")\n' + self.definition['sources'][0]['sha256'] = hashlib.sha256(source).hexdigest() + self.definition_raw = json.dumps(self.definition).encode() + self.manifest['id'] = uuid.uuid4().hex + self.manifest['recipes'][0]['sha256'] = hashlib.sha256(self.definition_raw).hexdigest() + for name, raw in {'recipe.py':source,'recipe.json':self.definition_raw, + 'project.json':json.dumps(self.manifest).encode()}.items(): + (self.project_path/name).write_bytes(raw) + with self.owner.bound(self.dataset): + self.dataset.projects.open({'root':'fixture','manifest_path':'project.json'}) + self.graph = self.dataset.pipelines.create_external(self.graph_body()) + self.preflight = self.dataset.pipelines.preflight_external(self.graph['id'], self.graph['revision']) + with self.owner.bound(self.dataset): + run = self.dataset.runs.submit_external(self.body()) + self.await_state(run['id'], {'completed'}) + with self.owner.bound(self.dataset): + run = self.dataset.runs._load(run['id']) + return run, run['artifacts'][0] + + def segment(self, run, item, offset=0, maximum=7): + with self.owner.bound(self.dataset): + return self.dataset.runs.artifact_segment(run['id'], item['name'], { + 'expected_sha256':item['sha256'],'offset':offset,'max_bytes':maximum}) + + def test_reassembly_hash_offsets_exact_fields_and_no_whole_payload_scan(self): + run, item = self.complete() + offset, whole = 0, hashlib.sha256() + target = (self.dataset.runs.path/run['id']/item['name']).stat() + payload_reads = [] + original = os.pread + def bounded(fd, count, position): + info = os.fstat(fd) + if (info.st_dev,info.st_ino) == (target.st_dev,target.st_ino): + payload_reads.append(count) + return original(fd, count, position) + with patch.object(self.dataset.runs, '_copy_verified', side_effect=AssertionError('Whole-file verification forbidden for segments')), patch('runs.os.pread', side_effect=bounded): + while True: + value = self.segment(run,item,offset) + self.assertEqual(set(value), {'run_id','name','expected_sha256','total_bytes','media_type', + 'offset','bytes','next_offset','eof','segment_sha256','data_base64','verification'}) + raw = base64.b64decode(value['data_base64'],validate=True) + self.assertEqual(value['segment_sha256'],hashlib.sha256(raw).hexdigest()) + self.assertEqual(value['verification'],'segment_read_whole_hash_unverified') + self.assertEqual(value['offset'],offset) + self.assertEqual(value['bytes'],len(raw)) + self.assertEqual(value['next_offset'],offset+len(raw)) + self.assertEqual(value['expected_sha256'],item['sha256']) + self.assertEqual(value['total_bytes'],item['bytes']) + whole.update(raw); offset=value['next_offset'] + if value['eof']: + break + self.assertEqual(offset,item['bytes']) + self.assertEqual(whole.hexdigest(),item['sha256']) + self.assertLessEqual(max(payload_reads),7) + self.assertEqual(sum(payload_reads),item['bytes']) + eof=self.segment(run,item,item['bytes']) + self.assertTrue(eof['eof']); self.assertEqual(eof['bytes'],0) + self.assertEqual(eof['segment_sha256'],hashlib.sha256(b'').hexdigest()) + + def test_empty_artifact_and_request_refusals(self): + run,item=self.complete(empty=True) + value=self.segment(run,item) + self.assertEqual(value['data_base64'],'') + self.assertEqual(value['next_offset'],0); self.assertTrue(value['eof']) + good={'expected_sha256':item['sha256'],'offset':0,'max_bytes':8*1024*1024} + invalid=[dict(good,offset=True),dict(good,offset=-1),dict(good,offset=1), + dict(good,max_bytes=False),dict(good,max_bytes=0),dict(good,max_bytes=8*1024*1024+1), + dict(good,expected_sha256='A'*64),dict(good,extra='ignored'),{}] + with self.owner.bound(self.dataset): + for body in invalid: + with self.subTest(body=body),self.assertRaises(WorkbenchError): + self.dataset.runs.artifact_segment(run['id'],item['name'],body) + for name in ('../result.txt','/etc/passwd','custody-receipt.json','unknown.bin'): + with self.subTest(name=name),self.assertRaises(WorkbenchError): + self.dataset.runs.artifact_segment(run['id'],name,good) + with self.assertRaises(WorkbenchError) as error: + self.dataset.runs.artifact_segment(run['id'],item['name'],dict(good,expected_sha256='0'*64)) + self.assertEqual(error.exception.code,'conflict') + + def test_same_size_mutation_is_explicitly_unverified_and_whole_digest_fails(self): + run,item=self.complete() + first=self.segment(run,item,0,1) + path=self.dataset.runs.path/run['id']/item['name'] + original=path.read_bytes() + self.assertGreater(len(original),1) + path.write_bytes(original[:1]+bytes(byte^255 for byte in original[1:])) + remainder=self.segment(run,item,1,8*1024*1024) + received=base64.b64decode(first['data_base64'])+base64.b64decode(remainder['data_base64']) + self.assertNotEqual(hashlib.sha256(received).hexdigest(),item['sha256']) + self.assertEqual(remainder['segment_sha256'],hashlib.sha256(received[1:]).hexdigest()) + with self.owner.bound(self.dataset): + with self.assertRaises(WorkbenchError): + self.dataset.runs.artifact(run['id'],item['name']) + with self.assertRaises(WorkbenchError): + with self.dataset.runs.open_artifact(run['id'],item['name']): + pass + + def test_revocation_between_calls_and_cross_catalog_cannot_read(self): + run,item=self.complete() + body={'expected_sha256':item['sha256'],'offset':0,'max_bytes':1} + with self.assertRaises(AccessError): + self.dataset.runs.artifact_segment(run['id'],item['name'],body) + with self.dataset.access.bind(self.agent['token']): + first=self.dataset.runs.artifact_segment(run['id'],item['name'],body) + with self.owner.bound(self.dataset): + self.dataset.access.revoke(self.agent['identity']['credential_id']) + with self.assertRaises(AccessError): + with self.dataset.access.bind(self.agent['token']): + self.dataset.runs.artifact_segment(run['id'],item['name'],dict(body,offset=first['next_offset'])) + # A session from another real catalog cannot authorize this owner. + from app import Dataset + from auth_helpers import ExplicitOwnerFixture + other=Dataset(self.path/'other-catalog') + try: + actor=ExplicitOwnerFixture.bootstrap(other) + with actor.bound(other), self.assertRaises(AccessError): + self.dataset.runs.artifact_segment(run['id'],item['name'],body) + finally: + other.close() + + def test_in_read_mutation_nonregular_growth_and_incomplete_run_refused(self): + run,item=self.complete() + path=self.dataset.runs.path/run['id']/item['name'] + original=path.read_bytes(); info=path.stat(); pread=os.pread + def mutate(fd,count,offset): + raw=pread(fd,count,offset) + current=os.fstat(fd) + if (current.st_dev,current.st_ino)==(info.st_dev,info.st_ino): + path.write_bytes(b'x'*len(original)) + return raw + with patch('runs.os.pread',side_effect=mutate), self.assertRaises(WorkbenchError): + self.segment(run,item) + path.write_bytes(original+b'x') + with self.assertRaises(WorkbenchError): self.segment(run,item) + path.unlink(); path.symlink_to('/dev/zero') + with self.assertRaises(WorkbenchError): self.segment(run,item) + path.unlink(); os.mkfifo(path) + with self.assertRaises(WorkbenchError): self.segment(run,item) + path.unlink(); path.write_bytes(original) + queued=self.queued(self.body(approval=self.approve())) + with self.owner.bound(self.dataset), self.assertRaises(WorkbenchError): + self.dataset.runs.artifact_segment(queued['id'],item['name'],{ + 'expected_sha256':item['sha256'],'offset':0,'max_bytes':1}) diff --git a/tests/test_mcp_stdio.py b/tests/test_mcp_stdio.py new file mode 100644 index 00000000..73966a5f --- /dev/null +++ b/tests/test_mcp_stdio.py @@ -0,0 +1,243 @@ +"""Protocol boundary tests, with an authored HTTP stub (not workflow acceptance). + +Real SDK processes/clients are exercised only in the optional agent environment. +Public authenticated HTTP/domain acceptance is owned by test_agent_workflow. +""" +import importlib.util +import json +import os +from pathlib import Path +import select +import subprocess +import sys +import time +import unittest + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +import mcp_stdio as bridge + +SDK_AVAILABLE = all(importlib.util.find_spec(name) for name in ('mcp', 'anyio', 'jsonschema')) +CHILD = r''' +import os, time, anyio +from mcp_stdio import serve +class AuthoredClient: + def call(self, name, arguments): + time.sleep(float(os.environ.get('TULDOK_TEST_DELAY', '0'))) + if os.environ.get('TULDOK_TEST_FAIL'): + raise RuntimeError('SECRET_AUTH_TOKEN_MUST_NOT_LEAK') + return {'status': 200, 'result': {'dataset_id': 'a' * 32, 'mode': 'real', 'observed': name, + 'payload': 'x' * int(os.environ.get('TULDOK_TEST_PAYLOAD', '0'))}} +anyio.run(serve, AuthoredClient()) +''' + + +def request(method, request_id=1, params=None): + value = {'jsonrpc': '2.0', 'id': request_id, 'method': method} + if params is not None: + value['params'] = params + return value + + +def initialize(version='2025-06-18'): + return request('initialize', params={'protocolVersion': version, 'capabilities': {}, + 'clientInfo': {'name': 'authored-protocol-test', 'version': '1'}}) + + +class FramingTests(unittest.TestCase): + def test_strict_json_bounds_unicode_duplicates_and_finite_values(self): + self.assertEqual(bridge.parse_frame(b'{"id":1}\n'), {'id': 1}) + bad = [b'{"x":1,"x":2}\n', b'{"x":NaN}\n', b'{"x":1e999}\n', + b'{"x":"\\ud800"}\n', b'\xff\n', b'{}', b'[]\n', b'null\n', + b'{"x":' + b'[' * 66 + b'0' + b']' * 66 + b'}\n', + b' ' * bridge.INPUT_LIMIT + b'{}\n'] + for raw in bad: + with self.subTest(raw=raw[:60]), self.assertRaises(bridge.FrameError): + bridge.parse_frame(raw) + + def test_nul_in_initialize_metadata_and_object_keys_is_refused(self): + for value in (initialize(), {'jsonrpc': '2.0', 'method': 'ping', 'params': {'_meta': {'bad\x00key': 1}}}): + if value.get('method') == 'initialize': + value['params']['clientInfo']['name'] = 'client\x00name' + with self.subTest(value=value), self.assertRaisesRegex(bridge.FrameError, 'NUL'): + bridge.parse_frame(json.dumps(value).encode('utf-8') + b'\n') + + def test_profile_negotiates_only_admitted_version_and_requires_notification(self): + profile = bridge.Profile(['context_get']) + forwarded, error = profile.accept(initialize('1999-01-01')) + self.assertIsNone(error) + self.assertEqual(forwarded['params']['protocolVersion'], bridge.PROTOCOL_VERSION) + profile.admitted(forwarded) + self.assertEqual(profile.accept(request('tools/list', 2))[1]['error']['code'], -32000) + profile.replied({'id': 1, 'result': {}}) + self.assertIsNotNone(profile.accept(request('tools/list', 2))[1]) + profile.accept({'jsonrpc': '2.0', 'method': 'notifications/initialized'}) + self.assertEqual(profile.accept(request('tools/list', 2)), (request('tools/list', 2), None)) + self.assertIsNotNone(profile.accept(initialize())[1]) + + def test_invalid_ids_unknown_notifications_and_methods(self): + profile = bridge.Profile([]) + for bad in (True, 1.2, None, 2 ** 54, 'x' * 129): + with self.subTest(bad=bad): + self.assertEqual(profile.accept(request('ping', bad))[1]['error']['code'], -32600) + self.assertEqual(profile.accept(request('ping', '')), (request('ping', ''), None)) + self.assertEqual(profile.accept({'jsonrpc': '2.0', 'method': 'notifications/future'}), (None, None)) + self.assertEqual(profile.accept(request('resources/list'))[1]['error']['code'], -32601) + + def test_malformed_tool_names_and_arguments_are_typed_refusals(self): + profile = bridge.Profile(['context_get']) + profile.state = 'ready' + for name in ([], {}, None, True, 1): + with self.subTest(name=name): + value, refusal = profile.accept(request('tools/call', 2, {'name': name, 'arguments': {}})) + self.assertIsNone(value) + self.assertEqual(refusal['error']['code'], -32602) + for arguments in ([], None, 'text', True): + with self.subTest(arguments=arguments): + value, refusal = profile.accept(request('tools/call', 2, {'name': 'context_get', 'arguments': arguments})) + self.assertIsNone(value) + self.assertEqual(refusal['error']['code'], -32602) + + def test_final_encoding_cap_counts_structured_and_text_copies(self): + value = {'data': 'x' * (bridge.OUTPUT_LIMIT // 2)} + result = {'structuredContent': value, 'content': [{'type': 'text', 'text': json.dumps(value)}]} + with self.assertRaises(bridge.FrameError): + bridge.encode_response({'jsonrpc': '2.0', 'id': 1, 'result': result}) + + +@unittest.skipUnless(SDK_AVAILABLE, 'Optional MCP environment required; skipped tests are not protocol qualification') +class SDKProcessTests(unittest.TestCase): + def start(self, **env): + process = subprocess.Popen([sys.executable, '-c', CHILD], cwd=ROOT, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=dict(os.environ, **env)) + self.addCleanup(self.cleanup, process) + return process + + def cleanup(self, process): + if process.stdin is not None and process.stdin.closed: + process.stdin = None + if process.poll() is None: + process.terminate() + try: + process.communicate(timeout=5) + except subprocess.TimeoutExpired: + process.kill() + process.communicate(timeout=5) + + def send(self, process, value): + process.stdin.write(json.dumps(value).encode() + b'\n') + process.stdin.flush() + + def read(self, process, timeout=8): + deadline = time.monotonic() + timeout + raw = bytearray() + while not raw.endswith(b'\n'): + remaining = deadline - time.monotonic() + self.assertGreater(remaining, 0, 'Protocol reply exceeded test deadline') + ready, _, _ = select.select([process.stdout], [], [], remaining) + self.assertTrue(ready, 'No protocol reply') + block = os.read(process.stdout.fileno(), 1) + self.assertTrue(block, 'Bridge closed before reply') + raw.extend(block) + self.assertLessEqual(len(raw), bridge.OUTPUT_LIMIT) + return json.loads(raw) + + def ready(self, process, version=bridge.PROTOCOL_VERSION): + self.send(process, initialize(version)) + value = self.read(process) + self.assertEqual(value['result']['protocolVersion'], bridge.PROTOCOL_VERSION) + self.assertEqual(value['result']['capabilities'], {'tools': {}}) + self.send(process, {'jsonrpc': '2.0', 'method': 'notifications/initialized'}) + return value + + def test_real_sdk_lifecycle_versions_and_closed_capabilities(self): + for version in ('2025-06-18', '2024-11-05', '2099-01-01'): + with self.subTest(version=version): + process = self.start() + self.ready(process, version) + self.send(process, request('ping', 2)) + self.assertEqual(self.read(process)['result'], {}) + self.send(process, request('ping', '')) + self.assertEqual(self.read(process), {'jsonrpc': '2.0', 'id': '', 'result': {}}) + self.send(process, initialize()) + self.assertIn('error', self.read(process)) + process.stdin.close() + self.assertEqual(process.wait(timeout=8), 0) + self.assertEqual(process.stderr.read(), b'') + + def test_invalid_schema_is_protocol_error_and_never_dispatched(self): + process = self.start() + self.ready(process) + self.send(process, request('tools/call', 2, {'name': 'context_get', 'arguments': {'unexpected': True}})) + result = self.read(process) + self.assertEqual(result, {'jsonrpc': '2.0', 'id': 2, + 'error': {'code': -32602, 'message': 'Invalid tool arguments'}}) + self.send(process, request('ping', 3)) + self.assertEqual(self.read(process)['result'], {}) + + def test_unknown_method_malformed_json_and_incomplete_initialization(self): + process = self.start() + self.send(process, request('tools/list')) + self.assertIn('error', self.read(process)) + process.stdin.write(b'{"jsonrpc":"2.0","id":1,"id":2,"method":"ping"}\n') + process.stdin.flush() + self.assertEqual(self.read(process)['error']['code'], -32700) + self.send(process, request('resources/list', 3)) + self.assertEqual(self.read(process)['error']['code'], -32601) + self.ready(process) + for name in ([], {}): + self.send(process, request('tools/call', 4, {'name': name, 'arguments': {}})) + self.assertEqual(self.read(process)['error']['code'], -32602) + self.send(process, request('tools/call', 4, {'name': 'unknown', 'arguments': {}})) + self.assertEqual(self.read(process)['error']['code'], -32602) + + def test_serial_calls_refuse_overlap_and_do_not_retry_on_exception(self): + process = self.start(TULDOK_TEST_DELAY='0.3', TULDOK_TEST_FAIL='1') + self.ready(process) + self.send(process, request('tools/call', 2, {'name': 'context_get', 'arguments': {}})) + self.send(process, request('tools/call', 3, {'name': 'context_get', 'arguments': {}})) + results = [self.read(process), self.read(process)] + busy = next(item for item in results if item['id'] == 3) + failed = next(item for item in results if item['id'] == 2) + self.assertEqual(busy['error']['code'], -32000) + self.assertEqual(failed['result']['structuredContent']['result']['code'], 'bridge_failure') + self.assertNotIn('SECRET_AUTH', json.dumps(results)) + + def test_eof_and_oversized_line_are_bounded(self): + process = self.start() + process.stdin.write(b' ' * (bridge.INPUT_LIMIT + 1)) + process.stdin.flush() + self.assertEqual(self.read(process)['error']['code'], -32700) + process.stdin.close() + self.assertEqual(process.wait(timeout=8), 0) + + def test_final_encoded_oversize_is_explicit_tool_error(self): + process = self.start(TULDOK_TEST_PAYLOAD=str(17 * 1024 * 1024)) + self.ready(process) + self.send(process, request('tools/call', 2, {'name': 'context_get', 'arguments': {}})) + result = self.read(process)['result'] + self.assertTrue(result['isError']) + self.assertEqual(result['structuredContent']['result']['code'], 'response_too_large') + + def test_official_sdk_client_negotiation_list_and_call(self): + import anyio + from mcp import ClientSession, StdioServerParameters + from mcp.client.stdio import stdio_client + + async def exercise(): + params = StdioServerParameters(command=sys.executable, args=['-c', CHILD], cwd=str(ROOT)) + async with stdio_client(params) as (read, write): + async with ClientSession(read, write) as session: + initialized = await session.initialize() + self.assertEqual(initialized.protocolVersion, bridge.PROTOCOL_VERSION) + tools = await session.list_tools() + self.assertIn('context_get', [tool.name for tool in tools.tools]) + result = await session.call_tool('context_get', {}) + self.assertFalse(result.isError) + self.assertEqual(result.structuredContent['status'], 200) + anyio.run(exercise) + + +if __name__ == '__main__': + unittest.main()