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.
Files changed (89) hide show
  1. mas/lab/controller/__init__.py +7 -0
  2. mas/lab/controller/__main__.py +5 -0
  3. mas/lab/controller/agent_chat.py +226 -0
  4. mas/lab/controller/api.py +364 -0
  5. mas/lab/controller/artifact_discovery.py +107 -0
  6. mas/lab/controller/artifacts.py +112 -0
  7. mas/lab/controller/cli.py +493 -0
  8. mas/lab/controller/client.py +271 -0
  9. mas/lab/controller/config.py +75 -0
  10. mas/lab/controller/constants.py +30 -0
  11. mas/lab/controller/daemon.py +190 -0
  12. mas/lab/controller/deps.py +172 -0
  13. mas/lab/controller/fastapi_app.py +166 -0
  14. mas/lab/controller/http_server.py +243 -0
  15. mas/lab/controller/io_capture.py +55 -0
  16. mas/lab/controller/item_service.py +625 -0
  17. mas/lab/controller/job_store.py +209 -0
  18. mas/lab/controller/jobs.py +375 -0
  19. mas/lab/controller/kinds.py +149 -0
  20. mas/lab/controller/lab_registry.py +1076 -0
  21. mas/lab/controller/manifest_layout.py +832 -0
  22. mas/lab/controller/manifest_store.py +214 -0
  23. mas/lab/controller/manifest_validation.py +90 -0
  24. mas/lab/controller/models.py +215 -0
  25. mas/lab/controller/path_safety.py +68 -0
  26. mas/lab/controller/pipeline_validation.py +79 -0
  27. mas/lab/controller/registry.py +83 -0
  28. mas/lab/controller/routes/__init__.py +82 -0
  29. mas/lab/controller/routes/_api.py +15 -0
  30. mas/lab/controller/routes/apps.py +190 -0
  31. mas/lab/controller/routes/artifacts.py +37 -0
  32. mas/lab/controller/routes/benchmark.py +307 -0
  33. mas/lab/controller/routes/choices.py +141 -0
  34. mas/lab/controller/routes/datasets.py +91 -0
  35. mas/lab/controller/routes/design_patterns.py +121 -0
  36. mas/lab/controller/routes/eval_output.py +31 -0
  37. mas/lab/controller/routes/experiments.py +194 -0
  38. mas/lab/controller/routes/health.py +178 -0
  39. mas/lab/controller/routes/items.py +187 -0
  40. mas/lab/controller/routes/jobs.py +107 -0
  41. mas/lab/controller/routes/libraries.py +144 -0
  42. mas/lab/controller/routes/overlays.py +164 -0
  43. mas/lab/controller/routes/pipelines.py +139 -0
  44. mas/lab/controller/routes/registry.py +40 -0
  45. mas/lab/controller/routes/run.py +215 -0
  46. mas/lab/controller/routes/runs.py +392 -0
  47. mas/lab/controller/routes/scopes.py +139 -0
  48. mas/lab/controller/routes/uploads.py +24 -0
  49. mas/lab/controller/routes/validate.py +36 -0
  50. mas/lab/controller/run_bridge.py +276 -0
  51. mas/lab/controller/run_store.py +190 -0
  52. mas/lab/controller/schema_registry.py +109 -0
  53. mas/lab/controller/schemas/pipeline-step-types-post.json +764 -0
  54. mas/lab/controller/schemas/pipeline-step-types-pre.json +35 -0
  55. mas/lab/controller/scope_catalog.py +266 -0
  56. mas/lab/controller/scope_service.py +134 -0
  57. mas/lab/controller/sessions.py +63 -0
  58. mas/lab/controller/settings.py +65 -0
  59. mas/lab/controller/ui_stream/__init__.py +13 -0
  60. mas/lab/controller/ui_stream/app.py +2147 -0
  61. mas/lab/controller/ui_stream/artefact_bind.py +308 -0
  62. mas/lab/controller/ui_stream/auth.py +136 -0
  63. mas/lab/controller/ui_stream/bus.py +156 -0
  64. mas/lab/controller/ui_stream/export.py +400 -0
  65. mas/lab/controller/ui_stream/governance.py +141 -0
  66. mas/lab/controller/ui_stream/ingest.py +300 -0
  67. mas/lab/controller/ui_stream/inspect.py +55 -0
  68. mas/lab/controller/ui_stream/layouts.py +161 -0
  69. mas/lab/controller/ui_stream/metrics.py +274 -0
  70. mas/lab/controller/ui_stream/plot_folds.py +609 -0
  71. mas/lab/controller/ui_stream/plugin_registry.py +139 -0
  72. mas/lab/controller/ui_stream/refs.py +259 -0
  73. mas/lab/controller/ui_stream/replay.py +236 -0
  74. mas/lab/controller/ui_stream/replay_cli.py +707 -0
  75. mas/lab/controller/ui_stream/run_index.py +337 -0
  76. mas/lab/controller/ui_stream/spec_load.py +48 -0
  77. mas/lab/controller/ui_stream/spec_snapshot.py +313 -0
  78. mas/lab/controller/ui_stream/stream.py +95 -0
  79. mas/lab/controller/ui_stream/streams.py +42 -0
  80. mas/lab/controller/ui_stream/timeline.py +183 -0
  81. mas/lab/controller/ui_stream/ui_trace.py +258 -0
  82. mas/lab/controller/uploads.py +61 -0
  83. mas/lab/controller/worker_model.py +137 -0
  84. mas/lab/controller/workers.py +296 -0
  85. mas/lab/controller/workspace_library.py +70 -0
  86. mas_lab_component_controller-0.2.0.dist-info/METADATA +21 -0
  87. mas_lab_component_controller-0.2.0.dist-info/RECORD +89 -0
  88. mas_lab_component_controller-0.2.0.dist-info/WHEEL +4 -0
  89. 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")