diff --git a/docs/containers.md b/docs/containers.md index 68ca09c..017e96b 100644 --- a/docs/containers.md +++ b/docs/containers.md @@ -1,8 +1,8 @@ # Container images -The canonical container namespace is **`ghcr.io/unipat-ai`**. Ten packages carry fifteen release -versions and one archived experimental runtime: sixteen versions in total, all -`linux/amd64`. +The canonical container namespace is **`ghcr.io/unipat-ai`**. The inventory records +current releases, retained historical versions, and explicitly archived experimental +runtimes. All listed runtime releases target `linux/amd64`. [`resources/images.json`](../resources/images.json) records, for every version, the tag, the immutable GHCR manifest digest, the config digest, the platform, the package URL, and the @@ -17,13 +17,13 @@ The harness needs an **agent image** for the route being run, and for the extern |---|---|---| | Raw task files, Codex | [`sciencevision-codex`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex) | `server-20260930-h20` | | Rendered views, Codex | [`sciencevision-codex-2d`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-2d) | `server-20260930-h20` | -| Bundled MCP tools, Codex | [`sciencevision-codex-mcp`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-mcp) | `server-20261014-h20` | +| Bundled MCP tools, Codex | [`sciencevision-codex-mcp`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-mcp) | `server-20261125-sequence-h20` | | MCP client, Codex | [`sciencevision-codex-mcp-client`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-mcp-client) | `release-20260930-h20` | | Raw task files, Claude Code | [`sciencevision-claude-code`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code) | `server-20261002-h20` | | Rendered views, Claude Code | [`sciencevision-claude-code-2d`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code-2d) | `server-20261002-h20` | -| Bundled MCP tools, Claude Code | [`sciencevision-claude-code-mcp`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code-mcp) | `server-20261015-h20` | +| Bundled MCP tools, Claude Code | [`sciencevision-claude-code-mcp`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code-mcp) | `server-20261125-sequence-h20` | | MCP client, Claude Code | [`sciencevision-claude-code-mcp-client`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code-mcp-client) | `release-20261002-h20` | -| External HTTP MCP worker | [`sciencevision-mcp-worker`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-mcp-worker) | `server-20260924-h20` | +| External HTTP MCP worker | [`sciencevision-mcp-worker`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-mcp-worker) | `server-20261125-sequence-h20` | | Deterministic scorer | [`sciencevision-scorer`](https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-scorer) | `server-20261104-h20` | The naming is positional, not generational. For each agent engine, the name without a suffix is @@ -32,6 +32,13 @@ implementation, and `-mcp-client` connects a client-only wrapper to an external ## Bundled or external +The sequence-capable bundled Codex and Claude Code release is +`server-20261125-sequence-h20`; exact pullable digests and verification are in +[`resources/images.json`](../resources/images.json). These retain the previous +73 tools and add `sv3d_switch_sequence`. Use the explicit bundled-stdio task +generation described in [Medical sequence switching](medical-sequence-mcp.md). +The older tags below remain reproducibility references and are not rewritten. + There are two MCP layouts, and they are not interchangeable: - **Bundled.** `sciencevision-*-mcp` carries the CLI and its MCP implementation in one image. diff --git a/docs/evaluation.md b/docs/evaluation.md index 493dfe6..adc0151 100644 --- a/docs/evaluation.md +++ b/docs/evaluation.md @@ -37,6 +37,12 @@ A route ID is a label, not a permissions attestation. Reproducing a setting requ contract and a runtime profile that actually enforce its intended access, with the evidence recorded in the run receipt. +Medical multi-sequence tasks additionally use the declared public image manifest +and the sequence-capable runtime described in +[Medical sequence switching](medical-sequence-mcp.md). Regenerate task trees to +obtain their task-specific sequence enum and catalog; historical trees and +reported scores are unchanged. + ## Running the harness The entire evaluation harness is vendored under [`harness/`](../harness/), a copy of the diff --git a/docs/medical-sequence-mcp.md b/docs/medical-sequence-mcp.md new file mode 100644 index 0000000..a771333 --- /dev/null +++ b/docs/medical-sequence-mcp.md @@ -0,0 +1,118 @@ +# Medical sequence switching in evaluation + +`sv3d_switch_sequence` extends the evaluation MCP with the sequence-switching +capability introduced by [platform PR132](https://github.com/UniPat-AI/BabyVision-v2/pull/132). +It changes the active image inside one NIfTI session. Existing results and +frozen task trees retain their original tool surfaces. + +The bundled Codex and Claude Code runtimes retain their existing 73 tools and +add one capability. The separate external HTTP worker retains its 58 tools and +adds one. These profiles have different existing tools and wire schemas; their +catalogs are recorded separately. A task with one public image hides the new +tool. Other viewer families retain their existing surfaces. + +## Input contract + +Declare each public image in the task's existing `assets` list, using one +`primary` role and any additional `sequence` roles. Each must reference an +actual `.nii` or `.nii.gz` image and use `viewer: "niivue"` when a viewer is +declared. The primary image opens first regardless of attachment order. +The generator stages these public assets and writes the existing +`sciencevision.mcp_task_assets.v1` manifest. Runtime discovery reads that +manifest; it never searches adjacent files or invents missing modalities. + +The eval switch currently requires **3D images with the same NIfTI spatial +units** and a shared anatomical world coordinate system. It supports different +dimensions, voxel spacing and affine transforms when the current focus remains +within the target field of view. It does not provide temporal/4D frame switching, +DICOM-series import, or loading embedded JavaScript/base64 volumes from HTML. +The expert viewer's separate first-frame behavior is not an eval capability. + +`mask`, reference and ground-truth assets are not sequences. Existing asset +visibility rules still apply: only an explicitly public overlay is staged for +the model. An `R`, `A` or `B` file existing on disk is insufficient to make it +public. Source task questions and answer boundaries are unchanged. + +## Calls and state + +Open the declared primary with `sv3d_open_scene`, then inspect +`sv3d_get_state`. Multi-image sessions report `sequence` and `sequences`. +Ordinary names come from filenames, for example `T1GD`, `T1`, `T2`, `FLAIR`. +Filename collisions use a deterministic `./` path-qualified identifier. Use +the names in state or the task-specific tool enum. + +The wire call retains the runtime's existing `args` wrapper: + +```json +{"args":{"session_id":"","sequence":"T2"}} +``` + +State reports `sequence_focus_world` as a continuous world anchor. Displayed +slice indices select the nearest voxels; this quantization does not move the +stored world anchor. Crosshair and subsequent per-axis slice changes update +the anchor. Camera, mode, clipping and overlay visibility persist. Each target +uses its original intensity window. Public masks are resampled from their +original source with nearest-neighbor labels when grids differ. + +A missing, invalid or unavailable target returns an error without replacing +the session. Repeating the returned `replay_input` is deterministic. The +existing eval full reset remains close-and-reopen; this change does not add a +`viewer_reset` tool or invent persisted measurement annotations. + +## Generate new bundled-stdio tasks + +Use a published sequence-capable bundled image recorded in +[`resources/images.json`](../resources/images.json). Export its actual catalog +for the task's viewer family before generation: + +```bash +IMAGE=ghcr.io/unipat-ai/sciencevision-codex-mcp@sha256:98b57812659434bb02393ff250aacdb0d9fce79f05bdec6f888ff189ffa33e2a +docker run --rm --entrypoint sciencevision-mcp "$IMAGE" \ + --surface --viewer-family niivue.v1 > niivue-surface.json +cd harness +python -m scripts.harbor.qa_gen_to_tasks \ + --jsonl approved-medical-tasks.jsonl --out new-stdio-tasks \ + --containerized --agent-env codex-mcp \ + --bundled-mcp-image "$IMAGE" --mcp-surface ../niivue-surface.json +``` + +`claude-code-mcp` uses the same opt-in flag with its own exact image catalog. +The generator emits the bundled Dockerfile, public asset manifest, +`environment/mcp.stdio.json` and `environment/mcp-runtime-profile.json`. +The profile carries the real image's task-specialized catalog and schema hashes. +Use the emitted stdio config with the native launcher. This is the existing +**3D + Scaffold + Vision MCP** source-access setting, not MCP-only isolation. +The matrix driver's default HTTP config is not silently changed by this opt-in. + +Without `--bundled-mcp-image`, generation retains the external HTTP layout. +The default worker is +`ghcr.io/unipat-ai/sciencevision-mcp-worker@sha256:4c8a482d5cc1cce0d04eaa7861f463843fa50c95318100a0db877a828c843d4f`. +Use its own `--surface` output for that +profile. Public sources stay in the private worker, and the emitted per-task +manifest, enum and catalog hashes agree with the worker's actual `tools/list`. +Old worker tags are retained for reproduction and do not gain the new tool. + +## Auditable image build inputs + +The bundled overlay generator is +`harness/scripts/harbor/sequence_runtime_overlay.py`; it validates the source +fingerprints of the audited bundled base and emits only the changed files plus +`sequence-overlay.json`. `Dockerfile.sequence-overlay` merges these files into +that base without replacing its renderer, agent CLI, dependencies or 73 existing +wire schemas. Its two new shared modules are the same source used by the +external worker. + +The exact reusable bundled bases are +`ghcr.io/unipat-ai/sciencevision-codex-mcp@sha256:4de6598960d745f408e8f91050b3b73234416dd5ae86d35bf26637094a32b7ca` +and +`ghcr.io/unipat-ai/sciencevision-claude-code-mcp@sha256:74a05ae987097140b97ca976a406cf272866c9edbb6fa2313e897a25dab36df5`. +The overlay source was built before its eventual Git commit: its content manifest +records the actual base and file hashes; the final source commit is not claimed +as the image's build revision. + +The separate `Dockerfile.sequence-worker-overlay` updates the external worker's +reviewed source while retaining its non-root user, dependencies and healthcheck. +The standard full worker Dockerfile and allow-listed builder also include the +new capability when rebuilding from source. Release tags, digests and source +verification belong in the image inventory after an actual build and registry +readback; local candidates do not establish a pullable release. diff --git a/harness/sci3d_agent/config.py b/harness/sci3d_agent/config.py index a440aef..166102d 100644 --- a/harness/sci3d_agent/config.py +++ b/harness/sci3d_agent/config.py @@ -193,7 +193,9 @@ SYSTEM_PROMPT_MODE4_MEDICAL_MPR = ( "You are a medical 3D imaging analysis agent working with a CT/MRI " "volume, just as a radiologist would in a multiplanar (MPR) viewer. " - "Start a session with `sv3d_open_scene`, then explore the volume: " + "Start a session with `sv3d_open_scene`, then explore the volume. " + "When its state lists multiple sequences, `sv3d_switch_sequence` changes " + "the public MRI sequence while keeping the world focus: " "`sv3d_set_render_mode` switches between volume rendering and the " "mpr_axial / mpr_sagittal / mpr_coronal planes; `sv3d_set_slice` scrubs " "to a specific slice (with window/level); `sv3d_set_crosshair` aligns " @@ -218,6 +220,7 @@ "sv3d_set_render_mode", "sv3d_set_slice", "sv3d_set_crosshair", + "sv3d_switch_sequence", "sv3d_set_clip_plane", "sv3d_set_opacity", "sv3d_toggle_mask", diff --git a/harness/sci3d_agent/mcp/parity/allowlist.py b/harness/sci3d_agent/mcp/parity/allowlist.py index a997ca9..711fe51 100644 --- a/harness/sci3d_agent/mcp/parity/allowlist.py +++ b/harness/sci3d_agent/mcp/parity/allowlist.py @@ -68,6 +68,7 @@ class UnknownFamilyError(ValueError): "sv3d_set_slice", "sv3d_set_clip_plane", "sv3d_set_crosshair", + "sv3d_switch_sequence", "sv3d_segment_2d", "sv3d_segment_3d_volume", }) diff --git a/harness/sci3d_agent/mcp/sequence_catalog.py b/harness/sci3d_agent/mcp/sequence_catalog.py new file mode 100644 index 0000000..bb567f3 --- /dev/null +++ b/harness/sci3d_agent/mcp/sequence_catalog.py @@ -0,0 +1,87 @@ +"""One pure catalog specialization used by task generation and both runtimes.""" +from __future__ import annotations + +import hashlib +import json +from typing import Any + + +def digest(value) -> str: + return hashlib.sha256(json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +def wire_schema(schema): + return {"type": "object", "properties": {"args": schema}, + "required": ["args"], "additionalProperties": False} + + +def specialize_catalog(catalog, assets): + """Derive task receipts without opening container-only /data paths. + + Existing entries retain their exact image-supplied hashes. A pre-extension + image is never silently upgraded by the generator. + """ + from .tools.vision3d.sequences import sequence_entries, TOOLS + names = [name for name, _ in sequence_entries(assets)] + entries = [] + for raw in catalog.get("tools", ()): + entry = dict(raw) + if entry["name"] == "sv3d_switch_sequence": + if len(names) < 2: + continue + schema = {**TOOLS[0].input_schema, + "properties": {**TOOLS[0].input_schema["properties"], + "sequence": {"type": "string", "enum": names}}} + entry["schema_sha256"] = digest(wire_schema(schema)) + entries.append(entry) + tool_names = [entry["name"] for entry in entries] + return {**catalog, "tools": entries, "tool_names": tool_names, "tool_count": len(entries), + "catalog_sha256": digest(tool_names), "schema_sha256": digest(entries)} + + +def runline_catalog(specs, family, parameters): + """Fingerprint the unchanged 73-tool runtime's real wire registrations.""" + entries = [{"name": spec.name, "schema_sha256": digest(parameters(spec))} for spec in specs] + names = [entry["name"] for entry in entries] + return {"schema_version": "sciencevision.mcp_surface.v1", "server": "sciencevision", + "viewer_family": family, "gated": bool(family), "tools": entries, + "tool_names": names, "tool_count": len(names), + "catalog_sha256": digest(names), "schema_sha256": digest(entries), + "extension": {"tool": "sv3d_switch_sequence", "platform_pr": "https://github.com/UniPat-AI/BabyVision-v2/pull/132", + "semantics": "continuous world focus, nearest displayed slice; only declared primary/sequence NIfTI"}} + + +def install_runline(namespace: dict[str, Any]) -> None: + """Add this capability without replacing a run-line server or its schemas. + + The bundled runtime has image blocks and tools absent from the external + worker. Retain its original register/dispatch functions verbatim. + """ + from .tools.vision3d.sequences import task_tools, TOOLS + original_specs = namespace["tool_specs"] + original_main = namespace["main"] + + def tool_specs(family=None): + specs = list(original_specs(family)) + if family not in (None, "niivue.v1"): + return tuple(specs) + if family in (None, "niivue.v1") and not any(s.name == TOOLS[0].name for s in specs): + specs.extend(TOOLS) + return tuple(task_tools(specs)) + + def main(argv=None): + import sys + args = list(sys.argv[1:] if argv is None else argv) + if "--surface" not in args: + return original_main(args) + try: + family = namespace["_viewer_family"](args) + result = runline_catalog(tool_specs(family), family, namespace["_advertised_parameters"]) + result["legacy_surface"] = namespace["surface_for"](family, result["tool_names"]).as_dict() + print(json.dumps(result, sort_keys=True)) + return 0 + except ValueError as exc: + print(json.dumps({"error": str(exc)}), file=sys.stderr) + return 2 + + namespace.update(tool_specs=tool_specs, main=main) diff --git a/harness/sci3d_agent/mcp/server.py b/harness/sci3d_agent/mcp/server.py index 731969e..dd6d2a6 100644 --- a/harness/sci3d_agent/mcp/server.py +++ b/harness/sci3d_agent/mcp/server.py @@ -35,12 +35,33 @@ def list_tool_names(viewer_family: str | None = None) -> list[str]: return [spec.name for spec in selected_tools(viewer_family, tools=ALL_TOOLS)] +def advertised_parameters(spec: ToolSpec) -> dict[str, Any]: + """Export the existing wire shape without changing legacy registration.""" + from fastmcp.tools import FunctionTool + + if spec.name == "sv3d_switch_sequence": + from sci3d_agent.mcp.sequence_catalog import wire_schema + return wire_schema(spec.input_schema) + # mcp.tool(wrapped) performs this same signature-to-schema conversion. + return FunctionTool.from_function( + _safe_handler(spec), name=spec.name, description=spec.description + ).parameters + + def _build_fastmcp_server(viewer_family: str | None = None): from fastmcp import FastMCP mcp = FastMCP(SERVER_NAME) for spec in selected_tools(viewer_family, tools=ALL_TOOLS): wrapped = _safe_handler(spec) + if spec.name == "sv3d_switch_sequence": + # Preserve every legacy tool's wire schema. The new tool must + # advertise its actual inner args enum, rather than args: {}. + from fastmcp.tools import FunctionTool + + tool = FunctionTool.from_function(wrapped, name=spec.name, description=spec.description) + mcp.add_tool(tool.model_copy(update={"parameters": advertised_parameters(spec)})) + continue mcp.tool( name=spec.name, description=spec.description, diff --git a/harness/sci3d_agent/mcp/surface.py b/harness/sci3d_agent/mcp/surface.py index 10079f7..873147e 100644 --- a/harness/sci3d_agent/mcp/surface.py +++ b/harness/sci3d_agent/mcp/surface.py @@ -35,16 +35,19 @@ def selected_tools( ) -> list[ToolSpec]: """Select the actual server surface; unknown families fail closed.""" source = list(ALL_TOOLS if tools is None else tools) + from sci3d_agent.mcp.tools.vision3d.sequences import task_tools if not viewer_family: - return source + return task_tools(source) from sci3d_agent.mcp.parity.allowlist import advertised_tools_for_family - return list(advertised_tools_for_family(viewer_family, source)) + selected = list(advertised_tools_for_family(viewer_family, source)) + return task_tools(selected) if viewer_family == "niivue.v1" else selected def tool_schema_sha256(spec: ToolSpec) -> str: - """Fingerprint the strict schema the MCP server itself advertises.""" - return _sha256(spec.input_schema) + """Fingerprint actual wire parameters, including the handler args wrapper.""" + from .server import advertised_parameters + return _sha256(advertised_parameters(spec)) def surface_payload( diff --git a/harness/sci3d_agent/mcp/tools/vision3d/__init__.py b/harness/sci3d_agent/mcp/tools/vision3d/__init__.py index 89d8137..1ddd28f 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/__init__.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/__init__.py @@ -5,4 +5,6 @@ from sci3d_agent.mcp.tools.vision3d.snapshot import TOOLS as _snapshot from sci3d_agent.mcp.tools.vision3d.segment import TOOLS as _segment -TOOLS = [*_session, *_camera, *_state, *_snapshot, *_segment] +from sci3d_agent.mcp.tools.vision3d.sequences import TOOLS as _sequences + +TOOLS = [*_session, *_camera, *_state, *_snapshot, *_segment, *_sequences] diff --git a/harness/sci3d_agent/mcp/tools/vision3d/_crosshair.py b/harness/sci3d_agent/mcp/tools/vision3d/_crosshair.py index 6d23aa4..2c1f59e 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/_crosshair.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/_crosshair.py @@ -147,6 +147,8 @@ def set_crosshair_handler(args: Mapping[str, Any]) -> Mapping[str, Any]: level=s.slice.level, ) replace_slice(sid, new_slice) + from .sequences import remember_crosshair + remember_crosshair(sid, planes) applied_mode: Optional[str] = None if set_mode: diff --git a/harness/sci3d_agent/mcp/tools/vision3d/_snapshot_render.py b/harness/sci3d_agent/mcp/tools/vision3d/_snapshot_render.py index 1d1206e..d5be15a 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/_snapshot_render.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/_snapshot_render.py @@ -276,6 +276,19 @@ def _axis_for_mode(session: Session) -> str: def _attach_slice_locator(args: dict[str, Any], session: Session) -> None: """Add either ``index`` or ``fraction`` to a primitive-args dict.""" + if len(session.sequences) > 1: + import nibabel as nib + import numpy as np + + from ._slice_math import _AXIS_TO_NP + from .sequences import _focus_world + + image = nib.load(session.asset_path) + world = _focus_world(session, image) + voxel = np.linalg.solve(image.affine, [*world, 1])[:3] + axis = _AXIS_TO_NP[args["axis"]] + args["index"] = int(round(voxel[axis])) + return if session.slice.index is not None: args["index"] = int(session.slice.index) elif session.slice.fraction is not None: diff --git a/harness/sci3d_agent/mcp/tools/vision3d/_store.py b/harness/sci3d_agent/mcp/tools/vision3d/_store.py index d8c7151..356300e 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/_store.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/_store.py @@ -148,7 +148,8 @@ def replace_mode(sid: str, mode: Mode) -> Session: def replace_slice(sid: str, slice_state: SliceState) -> Session: store = get_store() s = store.get(sid) - new = replace(s, slice=slice_state) + from .sequences import update_slice_focus + new = update_slice_focus(s, slice_state) store.update(new) return new diff --git a/harness/sci3d_agent/mcp/tools/vision3d/_types.py b/harness/sci3d_agent/mcp/tools/vision3d/_types.py index 3a616df..5021ab5 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/_types.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/_types.py @@ -117,3 +117,9 @@ class Session: created_at: float # monotonic seconds ttl_seconds: int rng_seed: int = 0 # reserved for Phase 3.3 deterministic renders + sequences: tuple[tuple[str, str], ...] = () + sequence: Optional[str] = None + sequence_mask_path: Optional[str] = None + sequence_focus_world: Optional[tuple[float, float, float]] = None + sequence_focus_slice: Optional[SliceState] = None + sequence_windows: tuple[tuple[str, tuple[float, float]], ...] = () diff --git a/harness/sci3d_agent/mcp/tools/vision3d/sequences.py b/harness/sci3d_agent/mcp/tools/vision3d/sequences.py new file mode 100644 index 0000000..448d80a --- /dev/null +++ b/harness/sci3d_agent/mcp/tools/vision3d/sequences.py @@ -0,0 +1,255 @@ +"""Switch only among the public NIfTI images declared for this task. + +The same implementation runs in the external worker and the bundled runtime. +It never searches neighbouring files: the staged asset manifest is the boundary. +""" +from __future__ import annotations + +import hashlib +import json +import os +from dataclasses import replace +from pathlib import Path +from typing import Any, Mapping + +from sci3d_agent.mcp.registry import REGISTRY, ToolSpec, register +from sci3d_agent.mcp.tools.vision3d._store import get_store + + +def manifest_assets() -> list[dict[str, Any]] | None: + value = os.environ.get("SV_MCP_TASK_ASSET_MANIFEST", "").strip() + if not value: + return None + payload = json.loads(Path(value).read_text()) + if payload.get("schema_version") != "sciencevision.mcp_task_assets.v1": + raise ValueError("unsupported task asset manifest") + rows = payload.get("assets") + if not isinstance(rows, list) or not all(isinstance(r, dict) for r in rows): + raise ValueError("task asset manifest must declare assets") + ids, paths = set(), set() + for row in rows: + asset_id, value = row.get("asset_id"), row.get("asset_path") + if not isinstance(asset_id, str) or not asset_id or asset_id in ids: + raise ValueError("task asset identifiers must be unique and non-empty") + if not isinstance(value, str) or not value or value in paths: + raise ValueError("task asset paths must be unique and non-empty") + path = Path(value) + if os.environ.get("SV_MCP_TASK_ISOLATED") == "1": + if path.parent != Path("/data") or path.resolve().parent != Path("/data"): + raise ValueError("isolated task assets must be staged directly under /data") + ids.add(asset_id) + paths.add(value) + if sum(row.get("role") == "primary" and row.get("viewer") in (None, "", "niivue") + and row["asset_path"].lower().endswith((".nii", ".nii.gz")) for row in rows) > 1: + raise ValueError("task asset manifest declares multiple primary images") + return rows + + +def sequence_entries(rows: list[dict[str, Any]]) -> tuple[tuple[str, str], ...]: + paths = [] + for row in rows: + path = str(row.get("asset_path") or row.get("path") or "") + if row.get("role") not in {"primary", "sequence"}: + continue + if row.get("viewer") not in {None, "", "niivue"}: + continue + if path.lower().endswith((".nii", ".nii.gz")) and path not in paths: + paths.append(path) + # Match the platform's asset-order default and collision namespace. + bases = [Path(p).name[:-7] if p.lower().endswith(".nii.gz") else Path(p).name[:-4] for p in paths] + return tuple((base if bases.count(base) == 1 else "./" + Path(path).as_posix().lstrip("/"), path) + for base, path in zip(bases, paths)) + + +def initialize_sequences(session): + if session.kind != "nifti": + return session + rows = manifest_assets() + if rows is None: + return session + entries = sequence_entries(rows) + current = next((name for name, path in entries if Path(path).resolve() == Path(session.asset_path).resolve()), None) + if current is None or len(entries) < 2: + return session + return replace(session, sequences=entries, sequence=current, + sequence_mask_path=session.mask_path, + sequence_windows=((current, session.slice.window),)) + + +def sequence_state(session) -> dict[str, Any]: + if len(session.sequences) < 2: + return {} + import nibabel as nib + return {"sequence": session.sequence, + "sequence_focus_world": list(_focus_world(session, nib.load(session.asset_path))), + "sequence_focus_semantics": "continuous world anchor; displayed slice indices are nearest voxels", + "sequences": [{"name": name, "file": Path(path).name} for name, path in session.sequences]} + + +def task_tools(tools, rows=None): + """Specialize only the new capability, preserving every existing schema.""" + rows = manifest_assets() if rows is None else rows + if rows is None: + return list(tools) # image capability catalog, before task staging + names = [name for name, _ in sequence_entries(rows)] + result = [] + for tool in tools: + if tool.name != "sv3d_switch_sequence": + result.append(tool) + elif len(names) > 1: + schema = {**tool.input_schema, "properties": {**tool.input_schema["properties"], + "sequence": {"type": "string", "enum": names}}} + result.append(replace(tool, input_schema=schema)) + return result + + +def _focus_world(session, image): + import numpy as np + from sci3d_agent.mcp.tools.vision3d._slice_math import _AXIS_TO_NP + shape = image.shape + axis = _AXIS_TO_NP[session.slice.axis] + previous = session.sequence_focus_slice + if previous is not None and session.sequence_focus_world is not None: + if session.slice == previous: + return session.sequence_focus_world + values = np.linalg.solve(image.affine, [*session.sequence_focus_world, 1])[:3] + else: + values = np.array([(extent - 1) / 2 for extent in shape], dtype=float) + memory = getattr(session.slice, "axis_indices", (None,) * 3) + old_memory = getattr(previous, "axis_indices", (None,) * 3) + for i, value in enumerate(memory): + if value is not None and value != old_memory[i]: + values[i] = value + if previous is None or (session.slice.axis, session.slice.index, session.slice.fraction) != (previous.axis, previous.index, previous.fraction): + values[axis] = float(session.slice.index) if session.slice.index is not None else float(session.slice.fraction or 0) * (shape[axis] - 1) + return tuple(float(v) for v in (image.affine @ [*values, 1])[:3]) + + +def update_slice_focus(session, slice_state): + """Remember each explicit axis move, including on the legacy one-axis model.""" + candidate = replace(session, slice=slice_state) + if len(session.sequences) < 2: + return candidate + import nibabel as nib + image = nib.load(session.asset_path) + previous = replace(session, sequence_focus_world=_focus_world(session, image), + sequence_focus_slice=session.slice) + focus = _focus_world(replace(previous, slice=slice_state), image) + return replace(candidate, sequence_focus_world=focus, sequence_focus_slice=slice_state) + + +def remember_crosshair(sid, planes): + """The legacy handler returns three axes but stores only the active one.""" + store = get_store() + with store._lock: + session = store.get(sid) + if len(session.sequences) < 2: + return + import nibabel as nib + image = nib.load(session.asset_path) + voxel = [planes[axis]["index"] for axis in ("sagittal", "coronal", "axial")] + world = tuple(float(v) for v in (image.affine @ [*voxel, 1])[:3]) + store.update(replace(session, sequence_focus_world=world, sequence_focus_slice=session.slice)) + + +def _mask_for_target(session, target, original): + """Resample a public overlay with nearest labels, never treat it as an image.""" + import nibabel as nib + import numpy as np + from nibabel.processing import resample_from_to + from sci3d_agent.mcp.runtime.paths import render_cache_dir + if original is None: + return None + mask = nib.load(original) + if mask.shape == target.shape and np.allclose(mask.affine, target.affine): + return original + key = hashlib.sha256((str(Path(original).resolve()) + str(Path(original).stat().st_mtime_ns) + + repr(target.shape) + repr(target.affine.tolist())).encode()).hexdigest() + path = render_cache_dir() / "sequence-overlays" / f"{key}.nii.gz" + if not path.exists(): + path.parent.mkdir(parents=True, exist_ok=True) + nib.save(resample_from_to(mask, (target.shape, target.affine), order=0), path) + return str(path) + + +def switch_sequence(args: Mapping[str, Any]) -> dict[str, Any]: + # Loading, validation and the immutable replacement form one transaction. + # Keep other session mutations from interleaving with the slow image read. + with get_store()._lock: + return _switch_sequence_locked(args) + + +def _switch_sequence_locked(args: Mapping[str, Any]) -> dict[str, Any]: + import nibabel as nib + import numpy as np + from sci3d_agent.mcp.tools.vision3d._slice_math import _AXIS_TO_NP + from sci3d_agent.mcp.tools.vision3d.session import _get_state_handler + sid, name = args.get("session_id"), args.get("sequence") + try: + store = get_store() + session = store.get(sid) + known = dict(session.sequences) + if session.kind != "nifti" or len(known) < 2 or name not in known: + raise ValueError(f"sequence unavailable: {name!r}; available: {list(known)}") + if name != session.sequence: + source, target = nib.load(session.asset_path), nib.load(known[name]) + if len(source.shape) != 3 or len(target.shape) != 3: + raise ValueError("sequence switching requires 3D NIfTI images") + if source.header.get_xyzt_units()[0] != target.header.get_xyzt_units()[0]: + raise ValueError("sequences must use the same spatial units") + world = _focus_world(session, source) + voxel = np.linalg.solve(target.affine, [*world, 1])[:3] + if not np.isfinite(voxel).all() or np.any(voxel < -1e-6) or np.any(voxel > np.array(target.shape) - 1 + 1e-6): + raise ValueError("current world focus is outside the target sequence field of view") + # Validate/read the target before replacing the immutable session. + np.asanyarray(target.dataobj) + indices = tuple(int(round(v)) for v in voxel) + axis = _AXIS_TO_NP[session.slice.axis] + changes = {"index": indices[axis], "fraction": indices[axis] / max(1, target.shape[axis] - 1)} + if hasattr(session.slice, "axis_indices"): + changes["axis_indices"] = indices + mask_path = _mask_for_target(session, target, session.sequence_mask_path) + masks = session.masks_info + if masks: + # Recompute per-axis maxima from the target-grid labels rather + # than transforming rounded indices as if they were one point. + mask_data = np.asanyarray(nib.load(mask_path).dataobj) + mapped = [] + for mask in masks: + label = mask_data == int(mask.mask_id) + best = {a: int(np.argmax(label.sum(axis=tuple(j for j in range(3) if j != i)))) + for a, i in _AXIS_TO_NP.items()} if label.any() else {} + mapped.append(replace(mask, best_slices=best)) + masks = tuple(mapped) + windows = dict(session.sequence_windows) + if name not in windows: + from .session import _initial_slice_for_nifti + inspection = REGISTRY["sv_inspect_nifti"].handler({"path": known[name]}) + if "error" in inspection: + raise ValueError(inspection["error"]) + windows[name] = _initial_slice_for_nifti(inspection).window + changes.update(window=windows[name], level=sum(windows[name]) / 2) + corners = np.array([[x, y, z, 1] for x in (0, target.shape[0] - 1) + for y in (0, target.shape[1] - 1) for z in (0, target.shape[2] - 1)]) + bounds = (target.affine @ corners.T).T[:, :3] + next_slice = replace(session.slice, **changes) + next_session = replace(session, asset_path=known[name], sequence=name, + affine_4x4=tuple(tuple(float(v) for v in row) for row in target.affine), + bbox=(tuple(bounds.min(axis=0)), tuple(bounds.max(axis=0))), + slice=next_slice, mask_path=mask_path, masks_info=masks, + sequence_focus_world=world, sequence_focus_slice=next_slice, + sequence_windows=tuple(windows.items())) + store.update(next_session) + return {"state": _get_state_handler({"session_id": sid}), + "replay_input": {"session_id": sid, "sequence": name}} + except Exception as exc: + return {"error": str(exc)} + + +TOOLS = [register(ToolSpec( + name="sv3d_switch_sequence", + description="Switch a NIfTI session to an available public sequence. Read sequence/sequences in sv3d_get_state; preserves world focus, view and public overlay. Repeating a switch is deterministic.", + input_schema={"type": "object", "required": ["session_id", "sequence"], + "properties": {"session_id": {"type": "string"}, "sequence": {"type": "string"}}, + "additionalProperties": False}, + handler=switch_sequence, category="F"))] diff --git a/harness/sci3d_agent/mcp/tools/vision3d/session.py b/harness/sci3d_agent/mcp/tools/vision3d/session.py index d670a21..6d2c284 100644 --- a/harness/sci3d_agent/mcp/tools/vision3d/session.py +++ b/harness/sci3d_agent/mcp/tools/vision3d/session.py @@ -304,6 +304,8 @@ def _open_scene_handler(args: Mapping[str, Any]) -> Mapping[str, Any]: ttl=ttl, ) + from .sequences import initialize_sequences + sess = initialize_sequences(sess) try: get_store().add(sess) except CapacityError as exc: @@ -320,7 +322,7 @@ def _open_scene_handler(args: Mapping[str, Any]) -> Mapping[str, Any]: for m in sess.masks_info ], } - except SVToolError as exc: + except (SVToolError, ValueError, OSError) as exc: return {"error": str(exc)} @@ -364,6 +366,7 @@ def _get_state_handler(args: Mapping[str, Any]) -> Mapping[str, Any]: s = get_store().get(sid) except KeyError: return {"error": f"unknown session_id: {sid}"} + from .sequences import sequence_state ttl_left = max(0, int(s.ttl_seconds - (monotonic_now() - s.created_at))) return { "session_id": s.session_id, @@ -401,6 +404,7 @@ def _get_state_handler(args: Mapping[str, Any]) -> Mapping[str, Any]: "clip_cap": s.opacity.clip_cap, }, "ttl_remaining_s": ttl_left, + **sequence_state(s), "masks_info": [ { "mask_id": m.mask_id, diff --git a/harness/scripts/harbor/_agent_envs.py b/harness/scripts/harbor/_agent_envs.py index 238604b..f7ac0ac 100644 --- a/harness/scripts/harbor/_agent_envs.py +++ b/harness/scripts/harbor/_agent_envs.py @@ -112,6 +112,23 @@ def render_task_asset_manifest(self, container_paths: Mapping[str, Any]) -> str: separators=(",", ":"), ) + "\n" + def render_bundled_dockerfile(self, *, image: str) -> str: + """The existing source-plus-MCP stdio setting, explicitly opted into. + + This deliberately exposes the staged public source artifacts to the + agent, as the bundled setting already did. It is not MCP-only access. + """ + return ( + "# Generated bundled stdio MCP task; public source assets are visible.\n" + f"FROM {self._image_ref(image)}\n" + "COPY asset/ /data/\n" + f"COPY {self.task_asset_manifest_filename} {self.task_asset_manifest_path}\n" + "ENV SV_MCP_TASK_ISOLATED=1 \\\n" + f" SV_MCP_TASK_ASSET_MANIFEST={self.task_asset_manifest_path} \\\n" + " SV_RENDER_CACHE=/logs/agent/renders\n" + "WORKDIR /app\n" + ) + def render_dockerfile(self, *, image: str) -> str: """Render the worker-only Dockerfile that receives raw assets.""" return ( diff --git a/harness/scripts/harbor/build_harbor_tasks.py b/harness/scripts/harbor/build_harbor_tasks.py index 5ce7d15..9e914f5 100644 --- a/harness/scripts/harbor/build_harbor_tasks.py +++ b/harness/scripts/harbor/build_harbor_tasks.py @@ -100,7 +100,7 @@ # The worker image contains the MCP implementation and is resolved to a digest # by official launch preflight. The task-local Dockerfile is rendered by # ``MCP_WORKER_PACKAGING`` so it has a single owner across build and launch. -_MCP_WORKER_IMAGE = "sci3d-mcp-worker:dev" +_MCP_WORKER_IMAGE = "ghcr.io/unipat-ai/sciencevision-mcp-worker@sha256:4c8a482d5cc1cce0d04eaa7861f463843fa50c95318100a0db877a828c843d4f" _MCP_AGENT_ENVS = frozenset({"codex-mcp", "claude-code-mcp"}) # Labels, target masks, and segmentation sidecars may be verifier inputs, but @@ -736,6 +736,16 @@ def _task_assets(task: dict) -> list[dict[str, Any]]: if primary.get("role") is not None: row["role"] = primary["role"] assets.insert(0, row) + # Medical multi-sequence tasks name the opening image independently of + # attachment order. Keep all other multi-asset ordering unchanged. + if task.get("domain") == "medical" and any(row.get("role") == "sequence" for row in assets): + primary = [row for row in assets if row.get("role") == "primary"] + if len(primary) > 1: + raise ValueError("medical sequences require one primary image") + opening = primary[0] if primary else next((row for row in assets if row["asset_path"] == primary_path), None) + if opening is not None: + opening.setdefault("role", "primary") + assets = [opening, *(row for row in assets if row is not opening)] return assets @@ -2607,6 +2617,7 @@ def build_one( agent_allowed_hosts: Iterable[str] | None = None, mcp_catalog: Mapping[str, Any] | None = None, mcp_worker_image: str = _MCP_WORKER_IMAGE, + bundled_mcp_image: str | None = None, ) -> Path: """Build one task directory. @@ -2622,6 +2633,12 @@ def build_one( raise ValueError("mcp_catalog must be the JSON object emitted by sciencevision-mcp --surface") normalized_hosts = normalize_allowed_hosts(agent_allowed_hosts) env = AGENT_ENVS.get(agent_env, AGENT_ENVS["host"]) + if bundled_mcp_image is not None: + if not containerized or not _is_mcp_agent_env(env.name): + raise ValueError("bundled_mcp_image requires containerized codex-mcp or claude-code-mcp") + MCP_WORKER_PACKAGING._image_ref(bundled_mcp_image) + if mcp_catalog is None: + raise ValueError("bundled stdio requires --mcp-surface from that exact image") asset_visibility = _route_asset_visibility(task, env.name) effective_task = _effective_task_for_route(task, asset_visibility) _assert_eligible_assets(effective_task) @@ -2692,6 +2709,10 @@ def build_one( from sci3d_agent.mcp.surface import surface_payload effective_mcp_catalog = surface_payload(viewer_family) + if effective_mcp_catalog is not None and _is_mcp_agent_env(env.name): + from sci3d_agent.mcp.sequence_catalog import specialize_catalog + + effective_mcp_catalog = specialize_catalog(effective_mcp_catalog, staged.get("assets", [])) route_contract = _route_contract_for_task( effective_task, env.name, @@ -2775,22 +2796,33 @@ def build_one( # it here preserves the existing per-task diagnostic surface; the # worker receives the same value from the immutable contract below. per_task = env.env_provider(effective_task) if env.env_provider is not None else {} - (env_dir / "Dockerfile").write_text(_with_env(env.dockerfile, per_task)) (env_dir / MCP_WORKER_PACKAGING.task_asset_manifest_filename).write_text( MCP_WORKER_PACKAGING.render_task_asset_manifest(staged) ) - (env_dir / "Dockerfile.mcp-worker").write_text( - MCP_WORKER_PACKAGING.render_dockerfile(image=mcp_worker_image) - ) - (env_dir / "docker-compose.yaml").write_text( - MCP_WORKER_PACKAGING.render_compose( - viewer_family=str(mcp.get("viewer_family") or "") or None, - catalog_sha256=str(catalog.get("catalog_sha256") or "") or None, - schema_sha256=str(catalog.get("schema_sha256") or "") or None, - health_receipt_path=MCP_WORKER_PACKAGING.health_receipt_path, - http_surface=MCP_WORKER_PACKAGING.http_surface, + if bundled_mcp_image is not None: + (env_dir / "Dockerfile").write_text(_with_env( + MCP_WORKER_PACKAGING.render_bundled_dockerfile(image=bundled_mcp_image), per_task)) + (env_dir / "mcp.stdio.json").write_text(json.dumps({"mcpServers": { + "sciencevision": {"command": "sciencevision-mcp", "args": []}}}, indent=2) + "\n") + (env_dir / "mcp-runtime-profile.json").write_text(json.dumps({ + "schema_version": "sciencevision.bundled_mcp_profile.v1", "transport": "stdio", + "image": bundled_mcp_image, "public_source_assets_visible_to_agent": True, + "catalog": effective_mcp_catalog, + }, sort_keys=True, indent=2) + "\n") + else: + (env_dir / "Dockerfile").write_text(_with_env(env.dockerfile, per_task)) + (env_dir / "Dockerfile.mcp-worker").write_text( + MCP_WORKER_PACKAGING.render_dockerfile(image=mcp_worker_image) + ) + (env_dir / "docker-compose.yaml").write_text( + MCP_WORKER_PACKAGING.render_compose( + viewer_family=str(mcp.get("viewer_family") or "") or None, + catalog_sha256=str(catalog.get("catalog_sha256") or "") or None, + schema_sha256=str(catalog.get("schema_sha256") or "") or None, + health_receipt_path=MCP_WORKER_PACKAGING.health_receipt_path, + http_surface=MCP_WORKER_PACKAGING.http_surface, + ) ) - ) else: per_task = env.env_provider(effective_task) if env.env_provider is not None else {} (env_dir / "Dockerfile").write_text(_with_env(env.dockerfile, per_task)) @@ -2836,6 +2868,8 @@ def main() -> None: default=_MCP_WORKER_IMAGE, help="immutable-or-versioned worker image reference; official preflight requires a digest", ) + ap.add_argument("--bundled-mcp-image", default=None, + help="opt into the existing bundled-stdio source-plus-MCP setting using this exact image; requires --mcp-surface") args = ap.parse_args() mcp_catalog: Mapping[str, Any] | None = None @@ -2860,6 +2894,7 @@ def main() -> None: agent_allowed_hosts=args.agent_allowed_host, mcp_catalog=mcp_catalog, mcp_worker_image=args.mcp_worker_image, + bundled_mcp_image=args.bundled_mcp_image, ) for t in tasks ] diff --git a/harness/scripts/harbor/qa_gen_to_tasks.py b/harness/scripts/harbor/qa_gen_to_tasks.py index f1be8ac..c3ed0df 100644 --- a/harness/scripts/harbor/qa_gen_to_tasks.py +++ b/harness/scripts/harbor/qa_gen_to_tasks.py @@ -255,7 +255,14 @@ def main() -> None: help="for --agent-env codex-2d: number of rendered views to " "stage (overrides per-record n_views)", ) + ap.add_argument("--mcp-surface", type=Path, default=None, + help="catalog JSON from the exact MCP image and viewer family") + ap.add_argument("--bundled-mcp-image", default=None, + help="explicit bundled-stdio source-plus-MCP image; requires --mcp-surface") args = ap.parse_args() + mcp_catalog = json.loads(args.mcp_surface.read_text()) if args.mcp_surface is not None else None + if mcp_catalog is not None and not isinstance(mcp_catalog, dict): + ap.error("--mcp-surface must contain one JSON object") asset_root = args.asset_root if str(args.asset_root) else None @@ -285,6 +292,8 @@ def main() -> None: task, args.out, containerized=args.containerized, agent_env=args.agent_env, + mcp_catalog=mcp_catalog, + bundled_mcp_image=args.bundled_mcp_image, ) ) except RenderVisibilityError as exc: diff --git a/harness/scripts/harbor/sequence_runtime_overlay.py b/harness/scripts/harbor/sequence_runtime_overlay.py new file mode 100644 index 0000000..65b9978 --- /dev/null +++ b/harness/scripts/harbor/sequence_runtime_overlay.py @@ -0,0 +1,89 @@ +"""Stage the sequence extension over the audited 73-tool bundled runtime. + +No old renderer, tool schema, dependency, or agent CLI is replaced. The source +fingerprints make an unexpected base a hard failure rather than a partial port. +The caller supplies a source-only snapshot extracted from the chosen image. +""" +from __future__ import annotations + +import argparse +import hashlib +import json +from pathlib import Path + +_BASE = { + "sci3d_agent/mcp/tools/vision3d/_types.py": "cd536a365d68f56549a44c985ed0d703eed6374ec492956fb10656183e80a26c", + "sci3d_agent/mcp/tools/vision3d/session.py": "45419b8458082d0ab4beec602f7b81db1ca92475f6b24d5265ee4d2ff3990c78", + "sci3d_agent/mcp/tools/vision3d/__init__.py": "e97e5a253f4b7b51d86222b7c4c2180e2aa84d97461ed81d3402192c1401663b", + "sci3d_agent/mcp/server.py": "0d7a77a78492cb9ca29873fc2add8e0f481495e840badef4590d21e467c1120b", + "sci3d_agent/mcp/tools/vision3d/_state_view.py": "2e4de16d4182fce0124231dfb1e37d8080ae717e326db415c07494de2ac30c22", + "sci3d_agent/mcp/tools/vision3d/_store.py": "c8489ffdf770362e94fc5c92355b14266a0982e52340e3d3eb0b8c866e0d7755", + "sci3d_agent/mcp/tools/vision3d/_crosshair.py": "b286f0063f77c37ee363500c5635007e7857f5f2a8e73d0fba6d7d9c4f957bad", +} +_NEW = ("sci3d_agent/mcp/tools/vision3d/sequences.py", "sci3d_agent/mcp/sequence_catalog.py") + + +def _replace_once(text, before, after): + if text.count(before) != 1: + raise ValueError("runtime hook did not match exactly once") + return text.replace(before, after) + + +def build_overlay(snapshot: Path, source: Path, output: Path) -> dict: + if output.exists(): + raise ValueError("overlay output must be a new directory") + originals = {name: (snapshot / name).read_bytes() for name in _BASE} + if any(hashlib.sha256(originals[name]).hexdigest() != expected for name, expected in _BASE.items()): + raise ValueError("bundled runtime source does not match the audited base") + result = {name: raw.decode() for name, raw in originals.items()} + types = "sci3d_agent/mcp/tools/vision3d/_types.py" + # Session is the final class. Append defaults AFTER all existing fields, + # including run-line molecule, oblique_plane, components and selection. + extension = (source / types).read_text().split(" sequences: tuple[tuple[str, str], ...] = ()", 1)[1] + result[types] += "\n sequences: tuple[tuple[str, str], ...] = ()" + extension + session = "sci3d_agent/mcp/tools/vision3d/session.py" + result[session] = _replace_once(result[session], " try:\n get_store().add(sess)", + " from .sequences import initialize_sequences\n sess = initialize_sequences(sess)\n try:\n get_store().add(sess)") + state = "sci3d_agent/mcp/tools/vision3d/_state_view.py" + result[state] = _replace_once(result[state], " ttl_left = max(0, int(s.ttl_seconds - (monotonic_now() - s.created_at)))", + " from .sequences import sequence_state\n ttl_left = max(0, int(s.ttl_seconds - (monotonic_now() - s.created_at)))") + result[state] = _replace_once(result[state], ' "ttl_remaining_s": ttl_left,', + ' "ttl_remaining_s": ttl_left,\n **sequence_state(s),') + store = "sci3d_agent/mcp/tools/vision3d/_store.py" + result[store] = _replace_once(result[store], " new = replace(s, slice=slice_state)", + " from .sequences import update_slice_focus\n new = update_slice_focus(s, slice_state)") + crosshair = "sci3d_agent/mcp/tools/vision3d/_crosshair.py" + result[crosshair] = _replace_once(result[crosshair], " replace_slice(sid, new_slice)", + " replace_slice(sid, new_slice)\n from .sequences import remember_crosshair\n remember_crosshair(sid, planes)") + result[session] = _replace_once(result[session], " except SVToolError as exc:\n return {\"error\": str(exc)}", + " except (SVToolError, ValueError, OSError) as exc:\n return {\"error\": str(exc)}") + init = "sci3d_agent/mcp/tools/vision3d/__init__.py" + result[init] += "\nfrom sci3d_agent.mcp.tools.vision3d.sequences import TOOLS as _sequences\nTOOLS += _sequences\n" + server = "sci3d_agent/mcp/server.py" + result[server] = _replace_once(result[server], 'if __name__ == "__main__":', + 'from sci3d_agent.mcp.sequence_catalog import install_runline\ninstall_runline(globals())\n\n\nif __name__ == "__main__":') + for name in _NEW: + result[name] = (source / name).read_text() + report = {"schema_version": "sciencevision.sequence_overlay.v1", "base_files": _BASE, "output_files": {}} + output.mkdir(parents=True) + for name, text in result.items(): + compile(text, name, "exec") + path = output / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text) + report["output_files"][name] = hashlib.sha256(path.read_bytes()).hexdigest() + (output / "sequence-overlay.json").write_text(json.dumps(report, sort_keys=True, indent=2) + "\n") + return report + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--snapshot", type=Path, required=True) + parser.add_argument("--source", type=Path, default=Path(__file__).resolve().parents[2]) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + print(json.dumps(build_overlay(args.snapshot, args.source, args.output), sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/harness/scripts/harbor/templates/Dockerfile.sequence-overlay b/harness/scripts/harbor/templates/Dockerfile.sequence-overlay new file mode 100644 index 0000000..6c232ed --- /dev/null +++ b/harness/scripts/harbor/templates/Dockerfile.sequence-overlay @@ -0,0 +1,9 @@ +# Sequence capability over the audited bundled 73-tool runtime. +# Context: sequence_runtime_overlay.py output, never a repository/data tree. +ARG BASE_IMAGE +FROM ${BASE_IMAGE} +ARG SEQUENCE_OVERLAY_SHA256 +LABEL io.sciencevision.sequence-overlay.sha256="${SEQUENCE_OVERLAY_SHA256}" \ + io.sciencevision.sequence-overlay.platform-pr="https://github.com/UniPat-AI/BabyVision-v2/pull/132" +COPY sci3d_agent/ /app/sci3d_agent/ +COPY sequence-overlay.json /app/sequence-overlay.json diff --git a/harness/scripts/harbor/templates/Dockerfile.sequence-worker-overlay b/harness/scripts/harbor/templates/Dockerfile.sequence-worker-overlay new file mode 100644 index 0000000..24e2b3f --- /dev/null +++ b/harness/scripts/harbor/templates/Dockerfile.sequence-worker-overlay @@ -0,0 +1,10 @@ +# External worker profile. Context contains only reviewed source packages. +# Retain the audited worker's dependencies, non-root user, healthcheck and +# entrypoint; this is separate from the 73-tool bundled agent images. +ARG BASE_IMAGE +FROM ${BASE_IMAGE} +ARG SEQUENCE_SOURCE_SHA256 +LABEL io.sciencevision.sequence-source.sha256="${SEQUENCE_SOURCE_SHA256}" \ + io.sciencevision.sequence-overlay.platform-pr="https://github.com/UniPat-AI/BabyVision-v2/pull/132" +COPY --chown=10001:10001 sci3d_agent/ /opt/sciencevision-src/sci3d_agent/ +COPY --chown=10001:10001 sequence-source.json /opt/sciencevision-src/sequence-source.json diff --git a/harness/tests/harbor_adapters/test_claude_code_mcp_tasks.py b/harness/tests/harbor_adapters/test_claude_code_mcp_tasks.py index c7ce9ce..7a0f0bd 100644 --- a/harness/tests/harbor_adapters/test_claude_code_mcp_tasks.py +++ b/harness/tests/harbor_adapters/test_claude_code_mcp_tasks.py @@ -62,7 +62,7 @@ def test_dockerfile_references_agent_image_and_worker_owns_asset(tmp_path): assert "FROM sci3d-claude-code-mcp:latest" in dockerfile assert "COPY asset/ /data/" not in dockerfile worker_dockerfile = (task_dir / "environment" / "Dockerfile.mcp-worker").read_text() - assert "FROM sci3d-mcp-worker:dev" in worker_dockerfile + assert "FROM ghcr.io/unipat-ai/sciencevision-mcp-worker@sha256:4c8a482d5cc1cce0d04eaa7861f463843fa50c95318100a0db877a828c843d4f" in worker_dockerfile assert "COPY asset/ /data/" in worker_dockerfile compose = (task_dir / "environment" / "docker-compose.yaml").read_text() assert "sciencevision-mcp:" in compose diff --git a/harness/tests/harbor_adapters/test_sequence_mcp_runtime.py b/harness/tests/harbor_adapters/test_sequence_mcp_runtime.py new file mode 100644 index 0000000..359fb58 --- /dev/null +++ b/harness/tests/harbor_adapters/test_sequence_mcp_runtime.py @@ -0,0 +1,326 @@ +"""Portable NIfTI sequence capability, exercised without external datasets.""" +from __future__ import annotations + +import json +from pathlib import Path + +import nibabel as nib +import numpy as np +import pytest + +from sci3d_agent.mcp.registry import REGISTRY +from sci3d_agent.mcp.tools.vision3d._store import get_store, reset_store_for_tests + + +@pytest.fixture +def volumes(tmp_path, monkeypatch): + reset_store_for_tests() + entries = [] + for name, size, offset, role in ( + ("T1GD", 8, 0, "primary"), ("T2", 12, -2, "sequence"), + ("R", 8, 0, "mask"), + ): + affine = np.eye(4) + affine[:3, 3] = offset + image = nib.Nifti1Image(np.full((size,) * 3, 10 if name == "T1GD" else 40, np.int16), affine) + image.header.set_xyzt_units("mm") + path = tmp_path / f"{name}.nii.gz" + nib.save(image, path) + entries.append({"asset_id": name, "asset_path": str(path), "format": "nifti", "role": role}) + manifest = tmp_path / "task-assets.json" + manifest.write_text(json.dumps({"schema_version": "sciencevision.mcp_task_assets.v1", "assets": entries})) + monkeypatch.setenv("SV_MCP_TASK_ASSET_MANIFEST", str(manifest)) + yield entries, manifest + reset_store_for_tests() + + +def test_real_nifti_switch_preserves_world_focus_and_repeats(volumes): + entries, _ = volumes + opened = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]}) + assert "error" not in opened, opened + sid = opened["session_id"] + REGISTRY["sv3d_set_slice"].handler({"session_id": sid, "axis": "axial", "index": 3}) + assert "sv3d_switch_sequence" in REGISTRY + tool = REGISTRY["sv3d_switch_sequence"] + switched = tool.handler({"session_id": sid, "sequence": "T2"}) + assert "error" not in switched, switched + state = REGISTRY["sv3d_get_state"].handler({"session_id": sid}) + assert state["sequence"] == "T2" + assert [s["name"] for s in state["sequences"]] == ["T1GD", "T2"] + assert Path(get_store().get(sid).asset_path).name == "T2.nii.gz" + assert state["slice"]["index"] == 5 # world z=3, target starts at -2 + before = get_store().get(sid) + repeated = tool.handler(switched["replay_input"]) + assert "error" not in repeated + assert get_store().get(sid) == before + rejected = tool.handler({"session_id": sid, "sequence": "R"}) + assert "error" in rejected + assert get_store().get(sid) == before + + +def test_sequence_missing_file_does_not_mutate_session(volumes): + entries, _ = volumes + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + before = get_store().get(sid) + Path(entries[1]["asset_path"]).unlink() + assert "sv3d_switch_sequence" in REGISTRY + result = REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T2"}) + assert "error" in result + assert get_store().get(sid) == before + + +def test_task_surface_has_real_enum_and_single_sequence_hides_tool(volumes): + from sci3d_agent.mcp.surface import selected_tools + + _, manifest = volumes + tools = selected_tools("niivue.v1") + switch = next((t for t in tools if t.name == "sv3d_switch_sequence"), None) + assert switch is not None + assert switch.input_schema["properties"]["sequence"]["enum"] == ["T1GD", "T2"] + payload = json.loads(manifest.read_text()) + payload["assets"] = payload["assets"][:1] + manifest.write_text(json.dumps(payload)) + assert "sv3d_switch_sequence" not in {t.name for t in selected_tools("niivue.v1")} + assert "sv3d_switch_sequence" not in {t.name for t in selected_tools("gltf.v1")} + + +def test_actual_mcp_client_receives_sequence_enum(volumes): + import asyncio + from fastmcp import Client + from sci3d_agent.mcp.server import _build_fastmcp_server + + async def inspect(): + async with Client(_build_fastmcp_server("niivue.v1")) as client: + tools = (await client.session.list_tools()).tools + switch = next(t for t in tools if t.name == "sv3d_switch_sequence") + schema = switch.model_dump(by_alias=True)["inputSchema"] + assert schema["properties"]["args"]["properties"]["sequence"]["enum"] == ["T1GD", "T2"] + asyncio.run(inspect()) + + +def test_fractional_world_anchor_survives_roundtrip_and_slice_change(volumes): + entries, _ = volumes + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + tool = REGISTRY["sv3d_switch_sequence"] + for name in ("T2", "T1GD", "T2", "T1GD"): + result = tool.handler({"session_id": sid, "sequence": name}) + assert "error" not in result + assert result["state"]["sequence_focus_world"] == pytest.approx([3.5, 3.5, 3.5]) + REGISTRY["sv3d_set_slice"].handler({"session_id": sid, "axis": "axial", "index": 2}) + result = tool.handler({"session_id": sid, "sequence": "T2"}) + assert result["state"]["sequence_focus_world"] == pytest.approx([3.5, 3.5, 2]) + + +def test_public_mask_preserved_in_world_and_target_window_is_used(volumes, monkeypatch, tmp_path): + monkeypatch.setenv("SV_RENDER_CACHE", str(tmp_path / "cache")) + entries, _ = volumes + opened = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"], "mask_path": entries[2]["asset_path"]}) + sid = opened["session_id"] + original = get_store().get(sid) + switched = REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T2"}) + assert "error" not in switched, switched + current = get_store().get(sid) + assert current.mask_state == original.mask_state + assert [m.centroid_world for m in current.masks_info] == [m.centroid_world for m in original.masks_info] + assert nib.load(current.mask_path).shape == (12, 12, 12) + assert np.allclose(nib.load(current.mask_path).affine, nib.load(current.asset_path).affine) + assert current.slice.window != original.slice.window + assert current.bbox != original.bbox + + +def test_isolated_manifest_rejects_paths_outside_staged_data(volumes, monkeypatch): + monkeypatch.setenv("SV_MCP_TASK_ISOLATED", "1") + entries, _ = volumes + result = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]}) + assert "error" in result + assert get_store().count() == 0 + + +def test_generator_catalog_and_runtime_wire_schema_match(volumes): + from sci3d_agent.mcp.sequence_catalog import specialize_catalog, wire_schema, digest + from sci3d_agent.mcp.surface import surface_payload, selected_tools + + entries, _ = volumes + # No source or /data access is needed when deriving the task receipt. + catalog = surface_payload("niivue.v1") + actual = next(t for t in selected_tools("niivue.v1") if t.name == "sv3d_switch_sequence") + generated = specialize_catalog(catalog, entries) + entry = next(t for t in generated["tools"] if t["name"] == actual.name) + assert entry["schema_sha256"] == digest(wire_schema(actual.input_schema)) + assert generated["schema_sha256"] == catalog["schema_sha256"] + single = specialize_catalog(catalog, entries[:1]) + assert "sv3d_switch_sequence" not in single["tool_names"] + + +def test_pipeline_opens_declared_primary_and_manifest_is_public(volumes, tmp_path): + from scripts.harbor.build_harbor_tasks import _stage_assets + from scripts.harbor._agent_envs import MCP_WORKER_PACKAGING + + entries, _ = volumes + task = {"domain": "medical", "asset_path": entries[0]["asset_path"], + "assets": [entries[1], entries[2], entries[0]]} + staged = _stage_assets(task, tmp_path / "env") + assert staged["asset_path"] == "/data/T1GD.nii.gz" + manifest = json.loads(MCP_WORKER_PACKAGING.render_task_asset_manifest(staged)) + assert [r["role"] for r in manifest["assets"]] == ["primary", "sequence"] + assert not (tmp_path / "env/asset/R.nii.gz").exists() + + +def test_camera_started_before_slow_load_survives_switch(volumes, monkeypatch): + from concurrent.futures import ThreadPoolExecutor + from threading import Event + from sci3d_agent.mcp.tools.vision3d import camera + + entries, _ = volumes + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + old = get_store().get(sid) + camera_read, compute, loading, finish_load = (Event() for _ in range(4)) + original_orbit, original_load = camera._orbit_camera, nib.load + + def delayed_orbit(*args): + camera_read.set() + assert compute.wait(5) + return original_orbit(*args) + + def delayed_load(path, *args, **kwargs): + if str(path) == entries[1]["asset_path"]: + loading.set() + assert finish_load.wait(5) + return original_load(path, *args, **kwargs) + + monkeypatch.setattr(camera, "_orbit_camera", delayed_orbit) + monkeypatch.setattr(nib, "load", delayed_load) + with ThreadPoolExecutor(2) as pool: + moving = pool.submit(REGISTRY["sv3d_camera_orbit"].handler, {"session_id": sid, "d_azimuth_deg": 15, "d_elevation_deg": 0}) + assert camera_read.wait(5) # real handler already holds the old Session + switching = pool.submit(REGISTRY["sv3d_switch_sequence"].handler, {"session_id": sid, "sequence": "T2"}) + assert loading.wait(5) + compute.set() + finish_load.set() + assert "error" not in switching.result(5) + assert "error" not in moving.result(5) + current = get_store().get(sid) + assert current.sequence == "T2" + assert current.camera != old.camera + + +def test_invalid_nifti_does_not_mutate_session(volumes): + entries, _ = volumes + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + before = get_store().get(sid) + Path(entries[1]["asset_path"]).write_bytes(b"not a NIfTI") + assert "error" in REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T2"}) + assert get_store().get(sid) == before + + +def test_rotation_preserves_continuous_world_focus(volumes): + entries, _ = volumes + image = nib.load(entries[1]["asset_path"]) + affine = np.array([[0, -1, 0, 10], [1, 0, 0, -2], [0, 0, 1, -2], [0, 0, 0, 1]], dtype=float) + nib.save(nib.Nifti1Image(np.asanyarray(image.dataobj), affine, image.header), entries[1]["asset_path"]) + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + for name in ("T2", "T1GD"): + result = REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": name}) + assert "error" not in result, result + assert result["state"]["sequence_focus_world"] == pytest.approx([3.5] * 3) + + +def test_crosshair_then_multiple_slice_axes_keep_actual_focus(volumes): + entries, _ = volumes + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + moved = REGISTRY["sv3d_set_crosshair"].handler({"session_id": sid, "voxel": [1, 2, 3]}) + assert "error" not in moved, moved + result = REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T2"}) + assert result["state"]["sequence_focus_world"] == pytest.approx([1, 2, 3]) + REGISTRY["sv3d_set_slice"].handler({"session_id": sid, "axis": "sagittal", "index": 6}) + REGISTRY["sv3d_set_slice"].handler({"session_id": sid, "axis": "coronal", "index": 7}) + result = REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T1GD"}) + assert result["state"]["sequence_focus_world"] == pytest.approx([4, 5, 3]) + + +def test_molecule_multi_primary_manifest_keeps_existing_surface(tmp_path, monkeypatch): + from sci3d_agent.mcp.surface import selected_tools + manifest = tmp_path / "assets.json" + manifest.write_text(json.dumps({"schema_version": "sciencevision.mcp_task_assets.v1", "assets": [ + {"asset_id": name, "asset_path": f"/data/{name}.cif", "role": "primary", "viewer": "molstar"} + for name in ("a", "b") + ]})) + monkeypatch.setenv("SV_MCP_TASK_ASSET_MANIFEST", str(manifest)) + names = {tool.name for tool in selected_tools("molstar.v2")} + assert "sv3d_open_scene" in names + assert "sv3d_switch_sequence" not in names + + +def test_build_one_bundled_stdio_has_manifest_and_image_catalog(volumes, tmp_path): + from scripts.harbor.build_harbor_tasks import build_one + from sci3d_agent.mcp.surface import surface_payload + + entries, _ = volumes + task = {"task_id": "medical-sequence-fixture", "domain": "medical", "instruction": "Inspect the supplied MRI.", + "asset_path": entries[0]["asset_path"], "asset_format": "nifti", + "asset": {"path": entries[0]["asset_path"], "format": "nifti", "viewer": "niivue", "role": "primary"}, + "assets": entries, "answer_schema": {"kind": "freeform"}, "scorer": {"primary": "exact_match"}, + "ground_truth": {"value": "synthetic test"}, "evaluation_eligible": False} + catalog = surface_payload("niivue.v1") + out = build_one(task, tmp_path / "tasks", containerized=True, agent_env="codex-mcp", + mcp_catalog=catalog, bundled_mcp_image="example.invalid/sequence-runtime:test") + env = out / "environment" + dockerfile = (env / "Dockerfile").read_text() + assert "FROM example.invalid/sequence-runtime:test" in dockerfile + assert "COPY asset/ /data/" in dockerfile + assert "COPY mcp-task-assets.json /etc/sciencevision-mcp/task-assets.json" in dockerfile + assert "SV_MCP_TASK_ASSET_MANIFEST=/etc/sciencevision-mcp/task-assets.json" in dockerfile + assert not (env / "Dockerfile.mcp-worker").exists() + assert not (env / "docker-compose.yaml").exists() + assert not (env / "asset/R.nii.gz").exists() + assert json.loads((env / "mcp.stdio.json").read_text())["mcpServers"]["sciencevision"]["command"] == "sciencevision-mcp" + profile = json.loads((env / "mcp-runtime-profile.json").read_text()) + assert profile["transport"] == "stdio" + assert "sv3d_switch_sequence" in profile["catalog"]["tool_names"] + + +def test_exported_catalog_matches_every_actual_wire_input_schema(volumes): + import asyncio + from fastmcp import Client + from sci3d_agent.mcp.server import _build_fastmcp_server + from sci3d_agent.mcp.sequence_catalog import digest + from sci3d_agent.mcp.surface import surface_payload + + expected = {entry["name"]: entry["schema_sha256"] for entry in surface_payload("niivue.v1")["tools"]} + + async def inspect(): + async with Client(_build_fastmcp_server("niivue.v1")) as client: + tools = (await client.session.list_tools()).tools + observed = {tool.name: digest(tool.model_dump(by_alias=True)["inputSchema"]) for tool in tools} + assert observed == expected + asyncio.run(inspect()) + + +@pytest.mark.parametrize(("mode", "dimension", "index"), [("mpr_coronal", 1, 4), ("mpr_sagittal", 0, 3)]) +def test_external_render_uses_the_selected_plane_of_world_anchor(volumes, monkeypatch, tmp_path, mode, dimension, index): + import base64 + import io + from PIL import Image + + monkeypatch.setenv("SV_RENDER_CACHE", str(tmp_path / "renders")) + entries, _ = volumes + image = nib.load(entries[1]["asset_path"]) + ijk = np.indices(image.shape) + data = (ijk[0] * 10 + ijk[1] * 100 + ijk[2]).astype(np.int16) + nib.save(nib.Nifti1Image(data, image.affine, image.header), entries[1]["asset_path"]) + sid = REGISTRY["sv3d_open_scene"].handler({"asset_path": entries[0]["asset_path"]})["session_id"] + REGISTRY["sv3d_set_crosshair"].handler({"session_id": sid, "voxel": [1, 2, 3]}) + REGISTRY["sv3d_switch_sequence"].handler({"session_id": sid, "sequence": "T2"}) + REGISTRY["sv3d_set_render_mode"].handler({"session_id": sid, "mode": mode}) + result = REGISTRY["sv3d_render"].handler({"session_id": sid, "width": 128, "height": 128}) + assert result.get("renderer_used") == "nifti_slice", result + assert result["axis"] == mode.removeprefix("mpr_") + assert result["slice_index"] == index + # Check decoded pixels against the real expected array plane, not the + # reported locator alone. No synthetic renderer or fake inspector. + pixels = np.asarray(Image.open(io.BytesIO(base64.b64decode(result["image_png_base64"]))))[:, :, :3] + plane = np.take(data, index, axis=dimension).astype(np.float32) + lo, hi = get_store().get(sid).slice.window + gray = ((np.clip(plane, lo, hi) - lo) / (hi - lo) * 255).astype(np.uint8) + expected = np.repeat(np.flipud(gray.T)[:, :, None], 3, axis=2) + assert np.max(np.abs(pixels.astype(int) - expected.astype(int))) <= 1 diff --git a/resources/harness.json b/resources/harness.json index 266d09a..237e96b 100644 --- a/resources/harness.json +++ b/resources/harness.json @@ -56,7 +56,8 @@ "local_modifications": [ "harness/README.md carries a vendored-harness pointer to the repository README.", "harness/_dev_serve.py serves its own directory instead of a hard-coded checkout path.", - "harness/pyproject.toml adds nibabel and scikit-image to the harbor extra and fastmcp to the mcp extra, so the documented install command satisfies the import chain." + "harness/pyproject.toml adds nibabel and scikit-image to the harbor extra and fastmcp to the mcp extra, so the documented install command satisfies the import chain.", + "2026-11-25: add sv3d_switch_sequence from platform PR132 to Niivue eval sessions, medical mode, public task manifests and task-specific wire catalogs; add explicit --bundled-mcp-image staging while retaining the external-HTTP default. Source-plus-MCP bundled runtime overlays preserve the existing 73 tools and add one; the separate external worker retains its existing 58 tools and adds one. Existing benchmark results are not rerun or rescored." ], "upstream_validation_reference": "https://github.com/UniPat-AI/BabyVision-v2/pull/127", "validation_note": "The upstream pull request reports scorer self-consistency checks. They are not model benchmark results and were not rerun for this repository." diff --git a/resources/images.json b/resources/images.json index 35fcf94..812cc33 100644 --- a/resources/images.json +++ b/resources/images.json @@ -1,8 +1,8 @@ { "schema_version": "sciencevision.image_inventory.v1", - "verified_at": "2026-11-04T07:35:00+00:00", - "status": "private_canonical_packages_verified", - "verification": "Re-read from GHCR on 2026-10-16 by scripts/verify_images.py, which reads every manifest and its config blob and compares the recorded digests against what the registry serves. A manifest digest addresses one immutable artifact; the config digest identifies the image content, so equal config digests establish equal declared uncompressed rootfs layer identities and runtime configuration. The pass did not download layer payloads or run containers. The experimental oracle runtime is an archived local build rather than a registry release, and its provenance is recorded separately on its entry. On 2026-11-04 the server-20261104-h20 in-container scorer was pushed to GHCR and verified: its manifest and config were read from the registry, and the image was started locally to import harbor_adapters.sci3d._score_core and run the 3-task gold smoke.", + "verified_at": "2026-11-25T07:59:40.762038+00:00", + "status": "canonical_packages_verified", + "verification": "Re-read from GHCR on 2026-10-16 by scripts/verify_images.py, which reads every manifest and its config blob and compares the recorded digests against what the registry serves. A manifest digest addresses one immutable artifact; the config digest identifies the image content, so equal config digests establish equal declared uncompressed rootfs layer identities and runtime configuration. The pass did not download layer payloads or run containers. The experimental oracle runtime is an archived local build rather than a registry release, and its provenance is recorded separately on its entry. On 2026-11-04 the server-20261104-h20 in-container scorer was pushed to GHCR and verified: its manifest and config were read from the registry, and the image was started locally to import harbor_adapters.sci3d._score_core and run the 3-task gold smoke. On 2026-11-25 the sequence-capable bundled Codex and Claude Code runtimes and the exact archived Codex base were verified separately; their per-entry verification records apply only to those releases. Existing historical entries remain unchanged. The 2026-11-25 external sequence worker was also verified by actual generated-task HTTP execution and registry readback; older worker versions are retained unchanged.", "images": [ { "role": "raw-file Codex", @@ -244,6 +244,82 @@ "linked_repository": "UniPat-AI/ScienceVision", "package_url": "https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-scorer", "usage": "Required by the dataset's harbor/templates/score.py: installs harbor_adapters.sci3d._score_core. Built from harness/scripts/harbor/templates/Dockerfile at f6b0929. Verified by importing the scoring core in the image and by a 3-task in-container gold smoke (3/3 at 1.0)." + }, + { + "role": "bundled MCP Codex", + "canonical": "ghcr.io/unipat-ai/sciencevision-codex-mcp:server-20261125-sequence-h20", + "canonical_manifest_digest": "sha256:98b57812659434bb02393ff250aacdb0d9fce79f05bdec6f888ff189ffa33e2a", + "canonical_digest_reference": "ghcr.io/unipat-ai/sciencevision-codex-mcp@sha256:98b57812659434bb02393ff250aacdb0d9fce79f05bdec6f888ff189ffa33e2a", + "config_digest": "sha256:ed4a8c5d1987ec7827d432950d9b06982359959c57265dd86ae595b4976d7966", + "rootfs_diff_id_count": 27, + "platform": "linux/amd64", + "visibility": "public", + "linked_repository": "UniPat-AI/ScienceVision", + "package_url": "https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-mcp", + "verified_at": "2026-11-25", + "usage": "Sequence-capable source-plus-MCP bundled runtime; existing 73 tool wire schemas preserved and one added.", + "verification": "Actual registry push, anonymous manifest/config hash readback, pull by digest and local image ID comparison. Sequence-capable images additionally passed real stdio MRI task staging, tools/list/catalog/schema agreement, switch and PNG render.", + "sequence_overlay_manifest_sha256": "119ecb0cd5af4e97be486a465920de3cda13c78d0f7127a91bbdd88b8e039d61", + "base_digest_reference": "ghcr.io/unipat-ai/sciencevision-codex-mcp@sha256:4de6598960d745f408e8f91050b3b73234416dd5ae86d35bf26637094a32b7ca", + "source_generator": "harness/scripts/harbor/sequence_runtime_overlay.py", + "build_template": "harness/scripts/harbor/templates/Dockerfile.sequence-overlay" + }, + { + "role": "bundled MCP Claude Code", + "canonical": "ghcr.io/unipat-ai/sciencevision-claude-code-mcp:server-20261125-sequence-h20", + "canonical_manifest_digest": "sha256:cf62e992965d5f5a8072bb6c5a96de7b702e63ed9d533f8208984e65d43aca26", + "canonical_digest_reference": "ghcr.io/unipat-ai/sciencevision-claude-code-mcp@sha256:cf62e992965d5f5a8072bb6c5a96de7b702e63ed9d533f8208984e65d43aca26", + "config_digest": "sha256:3cba979238074bd7afc9f85a439112de0abb718f8eca8511f5dcec843fb544c9", + "rootfs_diff_id_count": 25, + "platform": "linux/amd64", + "visibility": "public", + "linked_repository": "UniPat-AI/ScienceVision", + "package_url": "https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-claude-code-mcp", + "verified_at": "2026-11-25", + "usage": "Sequence-capable source-plus-MCP bundled runtime; existing 73 tool wire schemas preserved and one added.", + "verification": "Actual registry push, anonymous manifest/config hash readback, pull by digest and local image ID comparison. Sequence-capable images additionally passed real stdio MRI task staging, tools/list/catalog/schema agreement, switch and PNG render.", + "sequence_overlay_manifest_sha256": "119ecb0cd5af4e97be486a465920de3cda13c78d0f7127a91bbdd88b8e039d61", + "base_digest_reference": "ghcr.io/unipat-ai/sciencevision-claude-code-mcp@sha256:74a05ae987097140b97ca976a406cf272866c9edbb6fa2313e897a25dab36df5", + "source_generator": "harness/scripts/harbor/sequence_runtime_overlay.py", + "build_template": "harness/scripts/harbor/templates/Dockerfile.sequence-overlay" + }, + { + "role": "bundled MCP Codex reproducible base", + "canonical": "ghcr.io/unipat-ai/sciencevision-codex-mcp:sequence-base-20261125-6d95", + "canonical_manifest_digest": "sha256:4de6598960d745f408e8f91050b3b73234416dd5ae86d35bf26637094a32b7ca", + "canonical_digest_reference": "ghcr.io/unipat-ai/sciencevision-codex-mcp@sha256:4de6598960d745f408e8f91050b3b73234416dd5ae86d35bf26637094a32b7ca", + "config_digest": "sha256:6d95f43617f394ca4545af1d4377ab1649bbf93253633b094aebedc2f272a3cd", + "rootfs_diff_id_count": 25, + "platform": "linux/amd64", + "visibility": "public", + "linked_repository": "UniPat-AI/ScienceVision", + "package_url": "https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-codex-mcp", + "verified_at": "2026-11-25", + "usage": "Archived exact 73-tool Codex base for reproducing the sequence overlay; does not itself include the new tool.", + "verification": "Actual registry push and anonymous manifest/config hash readback; pulled image config matches the audited original base." + }, + { + "role": "external MCP worker", + "canonical": "ghcr.io/unipat-ai/sciencevision-mcp-worker:server-20261125-sequence-h20", + "canonical_manifest_digest": "sha256:4c8a482d5cc1cce0d04eaa7861f463843fa50c95318100a0db877a828c843d4f", + "canonical_digest_reference": "ghcr.io/unipat-ai/sciencevision-mcp-worker@sha256:4c8a482d5cc1cce0d04eaa7861f463843fa50c95318100a0db877a828c843d4f", + "config_digest": "sha256:d87bc3123af5a065c57fc9ef76d47303dd936a83da77a61f92913ac8e4675858", + "rootfs_diff_id_count": 17, + "platform": "linux/amd64", + "visibility": "public", + "linked_repository": "UniPat-AI/ScienceVision", + "package_url": "https://github.com/orgs/UniPat-AI/packages/container/package/sciencevision-mcp-worker", + "verified_at": "2026-11-25", + "base_digest_reference": "ghcr.io/unipat-ai/sciencevision-mcp-worker@sha256:292e3770e3a7ffd3397f575b9282bd3d65db2a6e3a30ceae838666949a56eafa", + "source_content_manifest_sha256": "4a7fdc0adc69e0156469009f595e8a2d8ece46991dd5fcaca834917977ca4547", + "build_template": "harness/scripts/harbor/templates/Dockerfile.sequence-worker-overlay", + "usage": "Sequence-capable default external HTTP worker. Existing 58 wire schemas preserved, one capability added; Niivue task-specific catalogs narrow tools and enum to declared public images.", + "verification": "Actual registry push, anonymous manifest/config hash readback, pull by digest and image ID comparison; non-root UID10001 and all114 staged source file hashes verified. Actual generated default HTTP task health, every live schema/catalog hash, four MRI sequences, switch, world focus and240x240 PNG passed. Local synthetic checks covered old58 wire compatibility, single image/non-Niivue hiding, invalid targets and affine/slice/mask behavior.", + "source_provenance": { + "source_base_commit": "42d99f68b9a4d64eea1a7e64ec76a01d0611d560", + "source_dirty": true, + "note": "Built from the recorded content manifest before the eventual feature commit; not labelled as that later commit." + } } ], "repository_linked_at": "2026-10-06", diff --git a/resources/sequence-worker-source.json b/resources/sequence-worker-source.json new file mode 100644 index 0000000..001e17c --- /dev/null +++ b/resources/sequence-worker-source.json @@ -0,0 +1,122 @@ +{ + "files": { + "sci3d_agent/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sci3d_agent/_tool_result.py": "90f35c340a21c4a1869d714a43f9cf9936c39a910d6bfd75a3a358cc86c4135d", + "sci3d_agent/agent.py": "1be42a2a55263a1e74c71cfc165808f490bbeaad5c8d7b13eaf803e22f9580a3", + "sci3d_agent/cli.py": "0030ebf2ef764156d201ede7fdb4cb581c9dcb27afb066edf5d3569f8906369f", + "sci3d_agent/config.py": "c5d709701c6196bdd52dc50bc7443ab9906b9a8597fbc3fc10f40529b5758817", + "sci3d_agent/dispatch.py": "dbb41a1a14408232fd4c19cebb34144bbdfd8c7d07afc50d0539b26dae40ffe9", + "sci3d_agent/kernel.py": "0e13ca38cf2727764f0bcfdfa438026a6e24401769ec3932fe9f5186d82014ae", + "sci3d_agent/llm_client.py": "22e634a6a160023a0dd8dc2eb59b7cc271000f9fa55d08262f6e6b0ab30f1cf7", + "sci3d_agent/mcp/__init__.py": "c982e752c73941e7fbd2d354001d8be4a87ad1238f74405706ba4097628ad9af", + "sci3d_agent/mcp/parity/__init__.py": "35fc887b04148ff17bebdd41d921169afa0d1e618ddcfd9469eeff26099e865c", + "sci3d_agent/mcp/parity/allowlist.py": "e7c1237da9871ffc67ccb1df4a04dd150b58e454240aa0538ffd396238581d07", + "sci3d_agent/mcp/registry.py": "267439fc6dd07f8b6adc201b97c8e374494734d698c8c5fa247fc0a7567cd206", + "sci3d_agent/mcp/runtime/__init__.py": "dcbe9494a7c0bc9d52cd60f6018769bf4326565ee51a5245c96d664dae21b7c4", + "sci3d_agent/mcp/runtime/cache.py": "717ccdea124a2c7e3dc36f84ef070144bfab80bb934578a0bbe49247c6d21173", + "sci3d_agent/mcp/runtime/errors.py": "2a3655f7653bc721f3cebd29ca4d79ddd2875d3e6b4b557908ef31fb3d1d05e0", + "sci3d_agent/mcp/runtime/paths.py": "ecd1bf4905d99a177779e35f0062242042487f5d8d734e84dda07db88bcae82b", + "sci3d_agent/mcp/schemas/sv3d_camera_dolly.json": "daf87111623882b2e9ccdb2a44bba8458dea94ac4a86c19d5e4e507551352fee", + "sci3d_agent/mcp/schemas/sv3d_camera_look_at.json": "582f1f985b2a8bdb405a9d96487263f38cc5ee6de64bbc0395630a697524fc5d", + "sci3d_agent/mcp/schemas/sv3d_camera_orbit.json": "7e56fc07969af6a08c969a1a99de529a223e3980a9717ca3ccae8eb92fb8459d", + "sci3d_agent/mcp/schemas/sv3d_camera_pan.json": "9e5aff4b9178ee61326d9582792f0598d41ef96c354ace2cbeffc76f8b4a4fe8", + "sci3d_agent/mcp/schemas/sv3d_camera_set_view.json": "0e5d8b014800649566648d2821f066bd392d6968822e28d81e5f383281553ae9", + "sci3d_agent/mcp/schemas/sv3d_close_scene.json": "a6b4e5a4d69544dc7b06c1e6efb9b55fda5af9612f1dcd07ff4a8ce47191a71c", + "sci3d_agent/mcp/schemas/sv3d_get_state.json": "a6b4e5a4d69544dc7b06c1e6efb9b55fda5af9612f1dcd07ff4a8ce47191a71c", + "sci3d_agent/mcp/schemas/sv3d_open_scene.json": "be5361c5455e822d8ac8d695edc161e2f6eb685e436f95a172ac2940c409069c", + "sci3d_agent/mcp/schemas/sv3d_render.json": "cca93c7d928535881d6d306d0a3688802f538cde679b6d3fae6377bce2c47826", + "sci3d_agent/mcp/schemas/sv3d_render_canonical_views.json": "6b180b44152143b9bd3ebdc3448caa7b02b7c7c1c3f3c42dd2aa8fb96615ef27", + "sci3d_agent/mcp/schemas/sv3d_set_clip_plane.json": "fc7b4295752a8673ef6d0f228e9d8bd98e045caa0bdf843b9627164c27613649", + "sci3d_agent/mcp/schemas/sv3d_set_opacity.json": "4fe3b7da95bdd6f7d123dfb9a414ff0fed13a756997ae95e434f7124501a823a", + "sci3d_agent/mcp/schemas/sv3d_set_render_mode.json": "07f9ec65ce7feee5af9e36c076e852d21ecbb43dfff3883c0f8b3e66330ead2d", + "sci3d_agent/mcp/schemas/sv3d_set_slice.json": "6b5e925da66749a6127552ebafe138a68e5fbaf4c15997ba82b197e64771a197", + "sci3d_agent/mcp/schemas/sv3d_toggle_mask.json": "b67094ec96a0df2228d1706ec57f739cd2d9a0e2c5b9efba69d6b0e8e00a4d74", + "sci3d_agent/mcp/schemas/sv_build_dual_pane_url.json": "046a29f6097986b12faf594cf0ff1fe5ed82ed4fa55f3d35fb58bef8873e3c9e", + "sci3d_agent/mcp/schemas/sv_build_match3d_url.json": "243089196f9470384505f5c733d54398dcf6b3c2342cdab4da8b55a7b9f173fb", + "sci3d_agent/mcp/schemas/sv_build_viewer_url.json": "da8c4f812e0861fbe05c6525eb853a2c7afe2f2f453c8b41730af07bd04abc56", + "sci3d_agent/mcp/schemas/sv_build_vqa_url.json": "57f25a7be8cc8b4085b4cf3942a6125674c92c8e662eaf115919e9a05c3768d8", + "sci3d_agent/mcp/schemas/sv_classify_v.json": "b5aea1a62925024d34790cc211f3ec723830263bc080fcfe11cd7717e80c5fac", + "sci3d_agent/mcp/schemas/sv_classify_v_batch.json": "579361c7493147ed942888de42e0060e6599f9ccb7e8f2be5b94a803448450ee", + "sci3d_agent/mcp/schemas/sv_get_asset.json": "15aef17f3fddc71164f7d812edc8706ce84a77ea2c77ef93360b3ddc61590c07", + "sci3d_agent/mcp/schemas/sv_get_astronomy_questions.json": "2eda893d24dad953786fd9b8d96ae23185a4bc05294388042dc0012c92bae16d", + "sci3d_agent/mcp/schemas/sv_get_matched_record.json": "affcf37fb8afc23ebc2956a0750d4ab4c6be394af81705aabd7d0c87a8610ce4", + "sci3d_agent/mcp/schemas/sv_get_v_classify_pilot_summary.json": "41cafcfd6ed930ba1283f8fd56d7b96c7ff69062a17c29a8efaeda4bd11b8e62", + "sci3d_agent/mcp/schemas/sv_get_vqa_sample.json": "a0e68d2cfff15adb3ab9710a8048b548251bd1e192916986a362719df3bdf48c", + "sci3d_agent/mcp/schemas/sv_inspect_mesh.json": "a1a5946e14d17ed84ee1e43381b24e40210c25a5ca8d8ca863fe1f7afdb7c08d", + "sci3d_agent/mcp/schemas/sv_inspect_molecule.json": "41e82d1572630bb03db4a1b12b6fdcd02585e2aca3a6ab3cf50b0ddb306aece1", + "sci3d_agent/mcp/schemas/sv_inspect_nifti.json": "803bb8a30d6c7e38d05d8fea342f7a6b750ebf087a84abf4afc3450681bebc57", + "sci3d_agent/mcp/schemas/sv_inspect_nifti_mask_pair.json": "263211709883014e9b2fd12cf25da49e55be9387f8e655dc1d4edbaaeff42eec", + "sci3d_agent/mcp/schemas/sv_inspect_pointcloud.json": "71752264e48e6d68536869c7f3a173aacb436be029838c24345f7771a0c04680", + "sci3d_agent/mcp/schemas/sv_inspect_scannet_scene.json": "0bff307b594a883f74afc62755fbd5f28419fbca3a86a2834112db7520d40edb", + "sci3d_agent/mcp/schemas/sv_inspect_urdf.json": "455f037410e92aaa9b47bcb9e2ddc31dd5370317faaa33e5eee6fb9adec66349", + "sci3d_agent/mcp/schemas/sv_inspect_volume_npy.json": "102f4ce1833fd09997810c7f919ea1f90b983ffd07ecd9d60bac9aaa9939eb93", + "sci3d_agent/mcp/schemas/sv_list_assets.json": "74f33b049d23854fe15eef15e4aab2dc810f6eb03e131aabb91dc554ffbe5783", + "sci3d_agent/mcp/schemas/sv_list_domains.json": "da7adbf7c72f0bfebee3e3e00bfde7d93c368cbea4b5d757d08a315c5ab0060c", + "sci3d_agent/mcp/schemas/sv_list_matched_datasets.json": "da7adbf7c72f0bfebee3e3e00bfde7d93c368cbea4b5d757d08a315c5ab0060c", + "sci3d_agent/mcp/schemas/sv_list_negative_samples.json": "deba72613b18fe85401fc13a0b7c57b0b9904718eca1f010b70fa5659eb63c85", + "sci3d_agent/mcp/schemas/sv_list_scenes.json": "5a74a93d08eb629a9c7d64beb49ffc6a4377267c364d0559bd34fdcd5abf1fd0", + "sci3d_agent/mcp/schemas/sv_list_vqa_datasets.json": "da7adbf7c72f0bfebee3e3e00bfde7d93c368cbea4b5d757d08a315c5ab0060c", + "sci3d_agent/mcp/schemas/sv_rebuild_matched_index.json": "c2f908496b37a8b7500350ddc89b347340c26b8a7670855e0b194e2a8e13080f", + "sci3d_agent/mcp/schemas/sv_render_mesh_thumbnail.json": "913ae249ede37e1d1ec2201158f8f89e1115f41f794c5d50e7381db352dde6ae", + "sci3d_agent/mcp/schemas/sv_render_mesh_view_sheet.json": "36bb696679a423a23a78525524900f12475a2537ff4da8c80a08374f8285b834", + "sci3d_agent/mcp/schemas/sv_render_molecule_thumbnail.json": "e19aad7f8889221a8a13089c2b52597641f383ee98ed99373e3f4d1277824e04", + "sci3d_agent/mcp/schemas/sv_render_nifti_mip.json": "c97a92d7a49f82db847b1f8499ace5f34f51e5565c54c7c8e7f0b0ecda1199c2", + "sci3d_agent/mcp/schemas/sv_render_nifti_overlay.json": "7dc08c2830bf3acc857b5081cb39e540843d79151a73dfa4bed00216498589f4", + "sci3d_agent/mcp/schemas/sv_render_nifti_slice.json": "3cf80707e9454f4ed7148da5ea6e273c9aaca0ce21786ce46f7ff191655bc69c", + "sci3d_agent/mcp/schemas/sv_render_pointcloud_thumbnail.json": "422a72a36c876997cf4685fa5f547777a01b485416f564a97ed2b8da4a085846", + "sci3d_agent/mcp/schemas/sv_render_qa_record_summary.json": "b7e835704b7b3a4ba9a96452ed0b4388a42ac4246f2215591ff8c07847491e0d", + "sci3d_agent/mcp/schemas/sv_run_m3d_pipeline.json": "cd0ce1b459a9fc80aa981438da55592b37299d49818ecc3a61e3840bc1d10468", + "sci3d_agent/mcp/schemas/sv_run_v_validation.json": "b7c32f3927c32c797285670ab5a5394d7814ba3fd9a542f88dea14fbbfaf9d6c", + "sci3d_agent/mcp/schemas/sv_score_astronomy.json": "1ea626df9ee0dfd07c2a0315ffff08f0ab7dc157e34344332bc1ccc30b6546b4", + "sci3d_agent/mcp/schemas/sv_search_matched_qa.json": "2096f58cc0e9882f55cfefa4bb44b4bbff81241844f74de87c90b1b75a3007eb", + "sci3d_agent/mcp/schemas/sv_validate_matched_index.json": "b1e28032fafd29376d530816cbaa46d529d23318a7ca3f1585392d0edaeb9fd0", + "sci3d_agent/mcp/sequence_catalog.py": "d0cc70092f3d882ab46abac5ef46c698629c991ea9de80968120dfd40740a056", + "sci3d_agent/mcp/server.py": "cf5b60cd294223299428c5c54185373c1bca94d090142408b90e8ee075f64a03", + "sci3d_agent/mcp/surface.py": "594614c2c4bd2892c9641eaa83509e6fa49af93c1df1c30eb23a632c88134928", + "sci3d_agent/mcp/tools/__init__.py": "98ac0cf1bc57b3b4e8b481eb2a6865a757e5788d10b22c5f4a38fa454c4eabb9", + "sci3d_agent/mcp/tools/_render/__init__.py": "d3e4171ecc7ebad69ed05fdfb0f692ebded9f62bf99b15bfe8fa4ca9360cf057", + "sci3d_agent/mcp/tools/_render/canonical_views.py": "4cb458c4a8e9bed0daaf825be700e0b911e887e4998ee7573ff5cf5cd257d299", + "sci3d_agent/mcp/tools/_render/common.py": "09545c6e28cdc4ad66101f9de95f13383055bdafa3340a85c1d9f1a1cb1eabe3", + "sci3d_agent/mcp/tools/_render/mesh.py": "a353324a03d049ff7b08f742d461b4af0d48b0274db8d87c6a655e6e8e916cf0", + "sci3d_agent/mcp/tools/_render/molecule.py": "66228d6976d51209c4198d6512ce03088db3affa640d9a01b312aba76213487a", + "sci3d_agent/mcp/tools/_render/nifti.py": "1af7e01438ce37881f266a222032e071133bf343c01b9f9cccaf9dfb3bda2944", + "sci3d_agent/mcp/tools/_render/pointcloud.py": "9516269518f6f52cf4af5d8b8dec321c7a22b620c0d81587dce0696763bd080b", + "sci3d_agent/mcp/tools/catalog.py": "ab111068b492bc99a73f04ea7d0a8a6a9db78a8e09126537a4ff0d52bbdef77b", + "sci3d_agent/mcp/tools/inspect.py": "c1dc58b3041405409cb2bdf3560ea16dded2b55af1a2d3fd0156e86eb923c371", + "sci3d_agent/mcp/tools/pipeline_read.py": "a9993c65f9bb415f9b625332b7e1c71a5cd57cc2ab929c4f5e1b54cbe1a7a924", + "sci3d_agent/mcp/tools/pipeline_write.py": "cfc2b5306b0f15bf34e3d4c82de2567e98a161f1c85f0b8e80f3a20712e3749e", + "sci3d_agent/mcp/tools/render_static.py": "bcb1209388fdc8322858f5d78c372765a11a241bd1335e79eb4b99eb3b0872b0", + "sci3d_agent/mcp/tools/urls.py": "0a3c18bc20f484ccf8df9afefbdb51614d638d2f958f90efdf71e64db6bd77f4", + "sci3d_agent/mcp/tools/vision3d/__init__.py": "9ae8adde5ecf36c7d7224845ad99cb778645847acc9fdb4c8e449a05805e7b59", + "sci3d_agent/mcp/tools/vision3d/_camera_math.py": "c7d6d0c8f89fcc60191e4fdf35cabe4eb5a2f7151579cd8678636dd8e69c6b5a", + "sci3d_agent/mcp/tools/vision3d/_crosshair.py": "14082384c98452dfb5b56c48bcfcbe6498a5f2a79e82871c27892d46cc5c5ca3", + "sci3d_agent/mcp/tools/vision3d/_schemas.py": "6b2e76f378d765b083a8f3f5b6a086b80701e824b5c026418fada98b17ab9c65", + "sci3d_agent/mcp/tools/vision3d/_segment_client.py": "d9156d820502f89cbb61937c0385482998297bbbf3b2f6dc7ac35bf05b882e38", + "sci3d_agent/mcp/tools/vision3d/_slice_math.py": "7653ef4bfd122670f72490df738b39d337d89317ce9af2357d0654cc27145dc5", + "sci3d_agent/mcp/tools/vision3d/_snapshot_camera.py": "d92c9ab12dcf042b5a714da82600509f76a4f10165a0ea176d29936e3561838b", + "sci3d_agent/mcp/tools/vision3d/_snapshot_render.py": "33657bd6b18092d82f2cfb58f13455d74f3fa98292f705c68a4e6ed89f7291fb", + "sci3d_agent/mcp/tools/vision3d/_store.py": "f2ae0c3b42d72d1524a726c8a1855e6bdf37c92f23eb6a771d75b01c4dc42184", + "sci3d_agent/mcp/tools/vision3d/_types.py": "5d5ff612dd14e0d15fb5c593d3599caeb345e4164ba7dc64d76532737961fd70", + "sci3d_agent/mcp/tools/vision3d/camera.py": "c2cb2a55940718d51eee8dd85ce5e07c0e936160d7c91239efa5f6a3fd4d0953", + "sci3d_agent/mcp/tools/vision3d/segment.py": "8b61f6868208bd3a83f873be2fbcf3187d3ac33aaa2240fc3bc7f685a42a6b79", + "sci3d_agent/mcp/tools/vision3d/sequences.py": "399bdc9a512d4618eed18ab4aa7c93ed5a3e296a1c7cb17d810aa611e574d611", + "sci3d_agent/mcp/tools/vision3d/session.py": "369550ba27ccd193d03324518811f881a429801128bef2da924a57a95618d1f5", + "sci3d_agent/mcp/tools/vision3d/snapshot.py": "3f6a31ce5f5e024f3f7c6f53ef8c9d398eacd0b3ef722881b026c76737cbeaaa", + "sci3d_agent/mcp/tools/vision3d/state.py": "21a7b547154c36020a1674ee8f0e354447a58a54e064e438bd94748ab54c423a", + "sci3d_agent/mcp_bridge.py": "8ea323cb366d63d44cf27ca28afa9e924fc8c5b212df995c06f6fd48acb2ffbb", + "sci3d_agent/modes.py": "d874a8d5c56362f61e2e60f16cdb867f40eafa4bd7f20a803d2928e4c8d41041", + "sci3d_agent/policy.py": "72ffb23d5c64c3281042184eedbedcd529810af72a77cd93e78ac0c51158ae4e", + "sci3d_agent/tools/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sci3d_agent/tools/execute_code.py": "7f998451bd213dd45ddd5f3b4032d68efebf2d29fbf774e991782200f260ad54", + "sci3d_agent/tools/finish.py": "7287b4d5c864be35e97ee8216b4de6c08f10834bded81869a9803adc4cec21bb", + "sci3d_agent/tools/render_view.py": "73df55879261b38e9b01da67ba90e8def92fb1572f25b9233f789ee1eadb20a2", + "sci3d_agent/tools/screenshot.py": "ba4f7b57a1340183d200b412a28b981f08da29ee4bee735f04c64166fcfa23b6", + "sci3d_agent/tools/set_camera.py": "aff1c826bce031de628e63eba0e8843273ab4783f5226243517479e8b035dfbc", + "sci3d_agent/trajectory.py": "9ccd511e5c3ff6747c2b1ba99e9a6947d5f6732e2fe7f413e2c052a4d13cdc3d", + "sci3d_agent/viewer_bridge.py": "766996e40061e04b398392d79ea1361b6b8df760969054bf663b07dc4da8c42a" + }, + "schema_version": "sciencevision.sequence_worker_source.v1", + "source_base_commit": "42d99f68b9a4d64eea1a7e64ec76a01d0611d560", + "source_dirty": true, + "source_repository": "UniPat-AI/ScienceVision" +}