mas-lab-component-controller 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mas/lab/controller/__init__.py +7 -0
- mas/lab/controller/__main__.py +5 -0
- mas/lab/controller/agent_chat.py +226 -0
- mas/lab/controller/api.py +364 -0
- mas/lab/controller/artifact_discovery.py +107 -0
- mas/lab/controller/artifacts.py +112 -0
- mas/lab/controller/cli.py +493 -0
- mas/lab/controller/client.py +271 -0
- mas/lab/controller/config.py +75 -0
- mas/lab/controller/constants.py +30 -0
- mas/lab/controller/daemon.py +190 -0
- mas/lab/controller/deps.py +172 -0
- mas/lab/controller/fastapi_app.py +166 -0
- mas/lab/controller/http_server.py +243 -0
- mas/lab/controller/io_capture.py +55 -0
- mas/lab/controller/item_service.py +625 -0
- mas/lab/controller/job_store.py +209 -0
- mas/lab/controller/jobs.py +375 -0
- mas/lab/controller/kinds.py +149 -0
- mas/lab/controller/lab_registry.py +1076 -0
- mas/lab/controller/manifest_layout.py +832 -0
- mas/lab/controller/manifest_store.py +214 -0
- mas/lab/controller/manifest_validation.py +90 -0
- mas/lab/controller/models.py +215 -0
- mas/lab/controller/path_safety.py +68 -0
- mas/lab/controller/pipeline_validation.py +79 -0
- mas/lab/controller/registry.py +83 -0
- mas/lab/controller/routes/__init__.py +82 -0
- mas/lab/controller/routes/_api.py +15 -0
- mas/lab/controller/routes/apps.py +190 -0
- mas/lab/controller/routes/artifacts.py +37 -0
- mas/lab/controller/routes/benchmark.py +307 -0
- mas/lab/controller/routes/choices.py +141 -0
- mas/lab/controller/routes/datasets.py +91 -0
- mas/lab/controller/routes/design_patterns.py +121 -0
- mas/lab/controller/routes/eval_output.py +31 -0
- mas/lab/controller/routes/experiments.py +194 -0
- mas/lab/controller/routes/health.py +178 -0
- mas/lab/controller/routes/items.py +187 -0
- mas/lab/controller/routes/jobs.py +107 -0
- mas/lab/controller/routes/libraries.py +144 -0
- mas/lab/controller/routes/overlays.py +164 -0
- mas/lab/controller/routes/pipelines.py +139 -0
- mas/lab/controller/routes/registry.py +40 -0
- mas/lab/controller/routes/run.py +215 -0
- mas/lab/controller/routes/runs.py +392 -0
- mas/lab/controller/routes/scopes.py +139 -0
- mas/lab/controller/routes/uploads.py +24 -0
- mas/lab/controller/routes/validate.py +36 -0
- mas/lab/controller/run_bridge.py +276 -0
- mas/lab/controller/run_store.py +190 -0
- mas/lab/controller/schema_registry.py +109 -0
- mas/lab/controller/schemas/pipeline-step-types-post.json +764 -0
- mas/lab/controller/schemas/pipeline-step-types-pre.json +35 -0
- mas/lab/controller/scope_catalog.py +266 -0
- mas/lab/controller/scope_service.py +134 -0
- mas/lab/controller/sessions.py +63 -0
- mas/lab/controller/settings.py +65 -0
- mas/lab/controller/ui_stream/__init__.py +13 -0
- mas/lab/controller/ui_stream/app.py +2147 -0
- mas/lab/controller/ui_stream/artefact_bind.py +308 -0
- mas/lab/controller/ui_stream/auth.py +136 -0
- mas/lab/controller/ui_stream/bus.py +156 -0
- mas/lab/controller/ui_stream/export.py +400 -0
- mas/lab/controller/ui_stream/governance.py +141 -0
- mas/lab/controller/ui_stream/ingest.py +300 -0
- mas/lab/controller/ui_stream/inspect.py +55 -0
- mas/lab/controller/ui_stream/layouts.py +161 -0
- mas/lab/controller/ui_stream/metrics.py +274 -0
- mas/lab/controller/ui_stream/plot_folds.py +609 -0
- mas/lab/controller/ui_stream/plugin_registry.py +139 -0
- mas/lab/controller/ui_stream/refs.py +259 -0
- mas/lab/controller/ui_stream/replay.py +236 -0
- mas/lab/controller/ui_stream/replay_cli.py +707 -0
- mas/lab/controller/ui_stream/run_index.py +337 -0
- mas/lab/controller/ui_stream/spec_load.py +48 -0
- mas/lab/controller/ui_stream/spec_snapshot.py +313 -0
- mas/lab/controller/ui_stream/stream.py +95 -0
- mas/lab/controller/ui_stream/streams.py +42 -0
- mas/lab/controller/ui_stream/timeline.py +183 -0
- mas/lab/controller/ui_stream/ui_trace.py +258 -0
- mas/lab/controller/uploads.py +61 -0
- mas/lab/controller/worker_model.py +137 -0
- mas/lab/controller/workers.py +296 -0
- mas/lab/controller/workspace_library.py +70 -0
- mas_lab_component_controller-0.2.0.dist-info/METADATA +21 -0
- mas_lab_component_controller-0.2.0.dist-info/RECORD +89 -0
- mas_lab_component_controller-0.2.0.dist-info/WHEEL +4 -0
- mas_lab_component_controller-0.2.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
"""Expose manifest schemas from package dependencies (no local copies in controller)."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Literal
|
|
9
|
+
|
|
10
|
+
from mas.lab.schemas.paths import bench_schema_dir, editor_schema_dir, runtime_schema_dir
|
|
11
|
+
|
|
12
|
+
SchemaFormat = Literal["yaml", "json"]
|
|
13
|
+
SchemaSource = Literal["runtime", "bench", "core", "controller"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class SchemaEntry:
|
|
18
|
+
id: str
|
|
19
|
+
title: str
|
|
20
|
+
filename: str
|
|
21
|
+
format: SchemaFormat
|
|
22
|
+
source: SchemaSource
|
|
23
|
+
description: str = ""
|
|
24
|
+
|
|
25
|
+
def resolve_path(self) -> Path:
|
|
26
|
+
if self.source == "runtime":
|
|
27
|
+
return runtime_schema_dir() / self.filename
|
|
28
|
+
if self.source == "bench":
|
|
29
|
+
return bench_schema_dir() / self.filename
|
|
30
|
+
if self.source == "core":
|
|
31
|
+
return editor_schema_dir() / self.filename
|
|
32
|
+
if self.source == "controller":
|
|
33
|
+
return _controller_schema_dir() / self.filename
|
|
34
|
+
raise KeyError(self.source)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _controller_schema_dir() -> Path:
|
|
38
|
+
return Path(__file__).resolve().parent / "schemas"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Registry mirrored by GET /api/schemas — ids align with mas-lab-ui consumption.
|
|
42
|
+
SCHEMA_REGISTRY: tuple[SchemaEntry, ...] = (
|
|
43
|
+
# Runtime (runtime/) — execution truth
|
|
44
|
+
SchemaEntry("agent", "Agent manifest", "agent.schema.yaml", "yaml", "runtime",
|
|
45
|
+
"kind: Agent — full runtime validation schema"),
|
|
46
|
+
SchemaEntry("mas", "MAS manifest", "mas.schema.yaml", "yaml", "runtime",
|
|
47
|
+
"kind: MAS — topology and agent references"),
|
|
48
|
+
SchemaEntry("overlay", "Overlay manifest", "overlay.schema.yaml", "yaml", "runtime",
|
|
49
|
+
"kind: Overlay — benchmark and run-mas overlays"),
|
|
50
|
+
SchemaEntry("infra", "Infra manifest", "infra.schema.yaml", "yaml", "runtime",
|
|
51
|
+
"apiVersion: infra/v1 — LLMProxy, InfraBundle, ToolRegistry, …"),
|
|
52
|
+
SchemaEntry("workflow", "Workflow topology", "workflow.schema.yaml", "yaml", "runtime",
|
|
53
|
+
"workflow/v1 topology (nodes + edges)"),
|
|
54
|
+
SchemaEntry("flavour", "Flavour", "flavour.schema.yaml", "yaml", "runtime",
|
|
55
|
+
"Runtime flavour / model routing"),
|
|
56
|
+
SchemaEntry("tool", "Tool", "tool.schema.yaml", "yaml", "runtime", "kind: Tool"),
|
|
57
|
+
SchemaEntry("tool-bundle", "Tool bundle", "tool_bundle.schema.yaml", "yaml", "runtime",
|
|
58
|
+
"kind: ToolBundle"),
|
|
59
|
+
SchemaEntry("prompt-bundle", "Prompt bundle", "prompt_bundle.schema.yaml", "yaml", "runtime",
|
|
60
|
+
"kind: PromptBundle"),
|
|
61
|
+
# Bench (lab/components/bench/) — lab library manifests
|
|
62
|
+
SchemaEntry("experiment", "Experiment", "experiment.schema.yaml", "yaml", "bench",
|
|
63
|
+
"Benchmark experiment.yaml"),
|
|
64
|
+
SchemaEntry("dataset", "Dataset", "dataset.schema.yaml", "yaml", "bench",
|
|
65
|
+
"Benchmark dataset files"),
|
|
66
|
+
SchemaEntry("lab-config", "Lab config", "lab-config.schema.yaml", "yaml", "bench",
|
|
67
|
+
"Library lab-config.yaml"),
|
|
68
|
+
SchemaEntry("pipeline-post", "Post-processing pipeline", "pipeline.schema.yaml", "yaml",
|
|
69
|
+
"bench", "pipeline: root — bench executor format"),
|
|
70
|
+
SchemaEntry("pipeline", "Pipeline manifest", "pipeline-manifest.schema.json", "json",
|
|
71
|
+
"bench", "kind: Pipeline — UI / library pipelines"),
|
|
72
|
+
# Controller-local registry (step type catalog for PipelineBuilder)
|
|
73
|
+
SchemaEntry("pipeline-step-types-pre", "Pipeline step types (pre)", "pipeline-step-types-pre.json",
|
|
74
|
+
"json", "controller", "Pre-benchmark pipeline steps"),
|
|
75
|
+
SchemaEntry("pipeline-step-types-post", "Pipeline step types (post)",
|
|
76
|
+
"pipeline-step-types-post.json", "json", "controller",
|
|
77
|
+
"Post-benchmark pipeline steps"),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
_REGISTRY_BY_ID = {entry.id: entry for entry in SCHEMA_REGISTRY}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def list_schemas() -> list[dict]:
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
"id": e.id,
|
|
87
|
+
"title": e.title,
|
|
88
|
+
"format": e.format,
|
|
89
|
+
"source": e.source,
|
|
90
|
+
"filename": e.filename,
|
|
91
|
+
"description": e.description,
|
|
92
|
+
}
|
|
93
|
+
for e in SCHEMA_REGISTRY
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_schema_entry(schema_id: str) -> SchemaEntry:
|
|
98
|
+
try:
|
|
99
|
+
return _REGISTRY_BY_ID[schema_id]
|
|
100
|
+
except KeyError as exc:
|
|
101
|
+
raise KeyError(f"Unknown schema id: {schema_id!r}") from exc
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def read_schema_text(schema_id: str) -> tuple[SchemaEntry, str]:
|
|
105
|
+
entry = get_schema_entry(schema_id)
|
|
106
|
+
path = entry.resolve_path()
|
|
107
|
+
if not path.is_file():
|
|
108
|
+
raise FileNotFoundError(f"Schema file missing for {schema_id!r}: {path}")
|
|
109
|
+
return entry, path.read_text(encoding="utf-8")
|