mas-lab-component-controller 0.2.0__tar.gz

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 (217) hide show
  1. mas_lab_component_controller-0.2.0/.coveragerc +7 -0
  2. mas_lab_component_controller-0.2.0/.gitignore +86 -0
  3. mas_lab_component_controller-0.2.0/PKG-INFO +21 -0
  4. mas_lab_component_controller-0.2.0/README.md +190 -0
  5. mas_lab_component_controller-0.2.0/pyproject.toml +39 -0
  6. mas_lab_component_controller-0.2.0/src/mas/lab/controller/__init__.py +7 -0
  7. mas_lab_component_controller-0.2.0/src/mas/lab/controller/__main__.py +5 -0
  8. mas_lab_component_controller-0.2.0/src/mas/lab/controller/agent_chat.py +226 -0
  9. mas_lab_component_controller-0.2.0/src/mas/lab/controller/api.py +364 -0
  10. mas_lab_component_controller-0.2.0/src/mas/lab/controller/artifact_discovery.py +107 -0
  11. mas_lab_component_controller-0.2.0/src/mas/lab/controller/artifacts.py +112 -0
  12. mas_lab_component_controller-0.2.0/src/mas/lab/controller/cli.py +493 -0
  13. mas_lab_component_controller-0.2.0/src/mas/lab/controller/client.py +271 -0
  14. mas_lab_component_controller-0.2.0/src/mas/lab/controller/config.py +75 -0
  15. mas_lab_component_controller-0.2.0/src/mas/lab/controller/constants.py +30 -0
  16. mas_lab_component_controller-0.2.0/src/mas/lab/controller/daemon.py +190 -0
  17. mas_lab_component_controller-0.2.0/src/mas/lab/controller/deps.py +172 -0
  18. mas_lab_component_controller-0.2.0/src/mas/lab/controller/fastapi_app.py +166 -0
  19. mas_lab_component_controller-0.2.0/src/mas/lab/controller/http_server.py +243 -0
  20. mas_lab_component_controller-0.2.0/src/mas/lab/controller/io_capture.py +55 -0
  21. mas_lab_component_controller-0.2.0/src/mas/lab/controller/item_service.py +625 -0
  22. mas_lab_component_controller-0.2.0/src/mas/lab/controller/job_store.py +209 -0
  23. mas_lab_component_controller-0.2.0/src/mas/lab/controller/jobs.py +375 -0
  24. mas_lab_component_controller-0.2.0/src/mas/lab/controller/kinds.py +149 -0
  25. mas_lab_component_controller-0.2.0/src/mas/lab/controller/lab_registry.py +1076 -0
  26. mas_lab_component_controller-0.2.0/src/mas/lab/controller/manifest_layout.py +832 -0
  27. mas_lab_component_controller-0.2.0/src/mas/lab/controller/manifest_store.py +214 -0
  28. mas_lab_component_controller-0.2.0/src/mas/lab/controller/manifest_validation.py +90 -0
  29. mas_lab_component_controller-0.2.0/src/mas/lab/controller/models.py +215 -0
  30. mas_lab_component_controller-0.2.0/src/mas/lab/controller/path_safety.py +68 -0
  31. mas_lab_component_controller-0.2.0/src/mas/lab/controller/pipeline_validation.py +79 -0
  32. mas_lab_component_controller-0.2.0/src/mas/lab/controller/registry.py +83 -0
  33. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/__init__.py +82 -0
  34. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/_api.py +15 -0
  35. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/apps.py +190 -0
  36. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/artifacts.py +37 -0
  37. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/benchmark.py +307 -0
  38. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/choices.py +141 -0
  39. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/datasets.py +91 -0
  40. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/design_patterns.py +121 -0
  41. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/eval_output.py +31 -0
  42. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/experiments.py +194 -0
  43. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/health.py +178 -0
  44. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/items.py +187 -0
  45. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/jobs.py +107 -0
  46. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/libraries.py +144 -0
  47. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/overlays.py +164 -0
  48. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/pipelines.py +139 -0
  49. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/registry.py +40 -0
  50. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/run.py +215 -0
  51. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/runs.py +392 -0
  52. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/scopes.py +139 -0
  53. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/uploads.py +24 -0
  54. mas_lab_component_controller-0.2.0/src/mas/lab/controller/routes/validate.py +36 -0
  55. mas_lab_component_controller-0.2.0/src/mas/lab/controller/run_bridge.py +276 -0
  56. mas_lab_component_controller-0.2.0/src/mas/lab/controller/run_store.py +190 -0
  57. mas_lab_component_controller-0.2.0/src/mas/lab/controller/schema_registry.py +109 -0
  58. mas_lab_component_controller-0.2.0/src/mas/lab/controller/schemas/pipeline-step-types-post.json +764 -0
  59. mas_lab_component_controller-0.2.0/src/mas/lab/controller/schemas/pipeline-step-types-pre.json +35 -0
  60. mas_lab_component_controller-0.2.0/src/mas/lab/controller/scope_catalog.py +266 -0
  61. mas_lab_component_controller-0.2.0/src/mas/lab/controller/scope_service.py +134 -0
  62. mas_lab_component_controller-0.2.0/src/mas/lab/controller/sessions.py +63 -0
  63. mas_lab_component_controller-0.2.0/src/mas/lab/controller/settings.py +65 -0
  64. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/__init__.py +13 -0
  65. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/app.py +2147 -0
  66. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/artefact_bind.py +308 -0
  67. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/auth.py +136 -0
  68. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/bus.py +156 -0
  69. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/export.py +400 -0
  70. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/governance.py +141 -0
  71. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/ingest.py +300 -0
  72. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/inspect.py +55 -0
  73. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/layouts.py +161 -0
  74. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/metrics.py +274 -0
  75. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/plot_folds.py +609 -0
  76. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/plugin_registry.py +139 -0
  77. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/refs.py +259 -0
  78. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/replay.py +236 -0
  79. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/replay_cli.py +707 -0
  80. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/run_index.py +337 -0
  81. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/spec_load.py +48 -0
  82. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/spec_snapshot.py +313 -0
  83. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/stream.py +95 -0
  84. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/streams.py +42 -0
  85. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/timeline.py +183 -0
  86. mas_lab_component_controller-0.2.0/src/mas/lab/controller/ui_stream/ui_trace.py +258 -0
  87. mas_lab_component_controller-0.2.0/src/mas/lab/controller/uploads.py +61 -0
  88. mas_lab_component_controller-0.2.0/src/mas/lab/controller/worker_model.py +137 -0
  89. mas_lab_component_controller-0.2.0/src/mas/lab/controller/workers.py +296 -0
  90. mas_lab_component_controller-0.2.0/src/mas/lab/controller/workspace_library.py +70 -0
  91. mas_lab_component_controller-0.2.0/tests/README.md +189 -0
  92. mas_lab_component_controller-0.2.0/tests/conftest.py +109 -0
  93. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/agents/concierge_agent.yaml +29 -0
  94. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/agents/itinerary_agent.yaml +21 -0
  95. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/agents/moderator.yaml +35 -0
  96. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/agents/schedule_agent.yaml +29 -0
  97. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/mas.yaml +42 -0
  98. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/apps/trip-planner/overlays/trip-planner.yaml +64 -0
  99. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/arborian-network.yaml +749 -0
  100. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/benchmark.yaml +669 -0
  101. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/mas-necessity.yaml +188 -0
  102. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/qa-agent-default.yaml +31 -0
  103. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/qa-reasoning-queries-100.yaml +1308 -0
  104. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/qa-reasoning-queries.yaml +125 -0
  105. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/trip-planner/benchmark-100.yaml +669 -0
  106. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/trip-planner/benchmark.yaml +1845 -0
  107. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/trip-planner/extensions-queries.yaml +136 -0
  108. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/trip-planner/lifecycle-queries.yaml +217 -0
  109. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/datasets/trip-planner/queries.yaml +82 -0
  110. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/experiments/trip-planner-design-pattern-experiment.yaml +41 -0
  111. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/infra/tool-providers.yaml +49 -0
  112. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/library.yaml +30 -0
  113. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/cot-moderator-layout.yaml +21 -0
  114. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/cot-moderator.yaml +15 -0
  115. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/observability-native.yaml +15 -0
  116. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/react-moderator-layout.yaml +21 -0
  117. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/react-moderator.yaml +15 -0
  118. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/reflection-moderator-layout.yaml +21 -0
  119. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/reflection-moderator.yaml +15 -0
  120. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/overlays/test-overlay.yaml +11 -0
  121. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/pipelines/pipeline-test.yaml +86 -0
  122. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/skills/answer-formatting/SKILL.md +29 -0
  123. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/calc.tool.yaml +28 -0
  124. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/get_attraction_fare.tool.yaml +36 -0
  125. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/get_attractions.tool.yaml +58 -0
  126. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/get_attractions_description.tool.yaml +30 -0
  127. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/get_fares.tool.yaml +36 -0
  128. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/get_trip_fares.tool.yaml +36 -0
  129. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/lookup_schedule.tool.yaml +49 -0
  130. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/memory-search.tool.yaml +22 -0
  131. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/query_graph_database.tool.yaml +48 -0
  132. mas_lab_component_controller-0.2.0/tests/fixtures/demo_lab/tools/web-search.tool.yaml +44 -0
  133. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/datasets/queries.yaml +9 -0
  134. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/experiments/smoke.yaml +11 -0
  135. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/lab-config.yaml +7 -0
  136. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/overlays/tune.yaml +11 -0
  137. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/x_lib/apps/hello/agents/hello.yaml +12 -0
  138. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/x_lib/apps/hello/mas.yaml +17 -0
  139. mas_lab_component_controller-0.2.0/tests/fixtures/lab_with_local_lib/x.lab/x_lib/library.yaml +8 -0
  140. mas_lab_component_controller-0.2.0/tests/fixtures/lab_without_library/lonely.lab/experiments/only.yaml +11 -0
  141. mas_lab_component_controller-0.2.0/tests/fixtures/lab_without_library/lonely.lab/lab-config.yaml +5 -0
  142. mas_lab_component_controller-0.2.0/tests/fixtures/readonly_lib/apps/locked/agents/locked.yaml +12 -0
  143. mas_lab_component_controller-0.2.0/tests/fixtures/readonly_lib/apps/locked/mas.yaml +17 -0
  144. mas_lab_component_controller-0.2.0/tests/fixtures/readonly_lib/library.yaml +8 -0
  145. mas_lab_component_controller-0.2.0/tests/fixtures/root_app_lib/agents/rootapp.yaml +12 -0
  146. mas_lab_component_controller-0.2.0/tests/fixtures/root_app_lib/library.yaml +6 -0
  147. mas_lab_component_controller-0.2.0/tests/fixtures/root_app_lib/mas.yaml +17 -0
  148. mas_lab_component_controller-0.2.0/tests/fixtures/templates/new-experiment.yaml +60 -0
  149. mas_lab_component_controller-0.2.0/tests/fixtures/templates/new-mas-coordinator.yaml +21 -0
  150. mas_lab_component_controller-0.2.0/tests/fixtures/templates/new-mas-researcher.yaml +19 -0
  151. mas_lab_component_controller-0.2.0/tests/fixtures/templates/new-mas.yaml +23 -0
  152. mas_lab_component_controller-0.2.0/tests/fixtures/templates/validate-agent.yaml +27 -0
  153. mas_lab_component_controller-0.2.0/tests/fixtures/templates/validate-mas.yaml +23 -0
  154. mas_lab_component_controller-0.2.0/tests/fixtures/templates/validate-overlay.yaml +17 -0
  155. mas_lab_component_controller-0.2.0/tests/fixtures/templates/validate-pipeline.yaml +56 -0
  156. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/other-folder/agents/renamed-app.yaml +12 -0
  157. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/other-folder/mas.yaml +17 -0
  158. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/plain/agents/plain.yaml +12 -0
  159. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/plain/mas.yaml +17 -0
  160. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/triage/v1/agents/triage.yaml +12 -0
  161. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/triage/v1/mas.yaml +17 -0
  162. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/triage/v2/agents/triage.yaml +12 -0
  163. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/apps/triage/v2/mas.yaml +17 -0
  164. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/library.yaml +12 -0
  165. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/overlays/baseline.yaml +11 -0
  166. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/skills/note/SKILL.md +11 -0
  167. mas_lab_component_controller-0.2.0/tests/fixtures/versioned_lib/tools/calc.tool.yaml +10 -0
  168. mas_lab_component_controller-0.2.0/tests/scope_fixtures.py +86 -0
  169. mas_lab_component_controller-0.2.0/tests/test_agent_chat.py +32 -0
  170. mas_lab_component_controller-0.2.0/tests/test_agent_chat_session_id.py +77 -0
  171. mas_lab_component_controller-0.2.0/tests/test_api_calls_contract.py +774 -0
  172. mas_lab_component_controller-0.2.0/tests/test_api_extended.py +139 -0
  173. mas_lab_component_controller-0.2.0/tests/test_artifacts_api.py +47 -0
  174. mas_lab_component_controller-0.2.0/tests/test_auth_cors.py +98 -0
  175. mas_lab_component_controller-0.2.0/tests/test_benchmark_cli_daemon.py +155 -0
  176. mas_lab_component_controller-0.2.0/tests/test_choices_api.py +57 -0
  177. mas_lab_component_controller-0.2.0/tests/test_client.py +295 -0
  178. mas_lab_component_controller-0.2.0/tests/test_controller.py +119 -0
  179. mas_lab_component_controller-0.2.0/tests/test_coverage_gaps.py +199 -0
  180. mas_lab_component_controller-0.2.0/tests/test_custom_panel_replay.py +100 -0
  181. mas_lab_component_controller-0.2.0/tests/test_daemon.py +83 -0
  182. mas_lab_component_controller-0.2.0/tests/test_deprecated_routes.py +54 -0
  183. mas_lab_component_controller-0.2.0/tests/test_edit_surface.py +153 -0
  184. mas_lab_component_controller-0.2.0/tests/test_event_bus_nonce.py +118 -0
  185. mas_lab_component_controller-0.2.0/tests/test_fastapi_app.py +387 -0
  186. mas_lab_component_controller-0.2.0/tests/test_fastapi_extended.py +304 -0
  187. mas_lab_component_controller-0.2.0/tests/test_inspect_demand.py +103 -0
  188. mas_lab_component_controller-0.2.0/tests/test_io_capture.py +17 -0
  189. mas_lab_component_controller-0.2.0/tests/test_ipc_and_workers.py +88 -0
  190. mas_lab_component_controller-0.2.0/tests/test_items_read.py +96 -0
  191. mas_lab_component_controller-0.2.0/tests/test_items_write.py +318 -0
  192. mas_lab_component_controller-0.2.0/tests/test_job_store.py +466 -0
  193. mas_lab_component_controller-0.2.0/tests/test_lab_discovery.py +488 -0
  194. mas_lab_component_controller-0.2.0/tests/test_lab_registry.py +144 -0
  195. mas_lab_component_controller-0.2.0/tests/test_layout_locate.py +45 -0
  196. mas_lab_component_controller-0.2.0/tests/test_library_discovery.py +91 -0
  197. mas_lab_component_controller-0.2.0/tests/test_manifest_store.py +129 -0
  198. mas_lab_component_controller-0.2.0/tests/test_manifest_validation.py +63 -0
  199. mas_lab_component_controller-0.2.0/tests/test_openapi_contract.py +29 -0
  200. mas_lab_component_controller-0.2.0/tests/test_overlay_registry.py +60 -0
  201. mas_lab_component_controller-0.2.0/tests/test_replay_cli.py +830 -0
  202. mas_lab_component_controller-0.2.0/tests/test_resolve_experiment.py +26 -0
  203. mas_lab_component_controller-0.2.0/tests/test_run_bridge.py +100 -0
  204. mas_lab_component_controller-0.2.0/tests/test_runners.py +70 -0
  205. mas_lab_component_controller-0.2.0/tests/test_runs_api.py +142 -0
  206. mas_lab_component_controller-0.2.0/tests/test_runtime_runners_api.py +18 -0
  207. mas_lab_component_controller-0.2.0/tests/test_schema_registry.py +116 -0
  208. mas_lab_component_controller-0.2.0/tests/test_scopes_api.py +100 -0
  209. mas_lab_component_controller-0.2.0/tests/test_sessions.py +61 -0
  210. mas_lab_component_controller-0.2.0/tests/test_stream_names.py +38 -0
  211. mas_lab_component_controller-0.2.0/tests/test_ui_auth.py +84 -0
  212. mas_lab_component_controller-0.2.0/tests/test_ui_export.py +293 -0
  213. mas_lab_component_controller-0.2.0/tests/test_ui_metrics.py +74 -0
  214. mas_lab_component_controller-0.2.0/tests/test_ui_stream.py +1224 -0
  215. mas_lab_component_controller-0.2.0/tests/test_uploads_api.py +39 -0
  216. mas_lab_component_controller-0.2.0/tests/test_workers_extended.py +47 -0
  217. mas_lab_component_controller-0.2.0/tests/test_write_safety.py +66 -0
@@ -0,0 +1,7 @@
1
+ [run]
2
+ source = mas.lab.controller.fastapi_app
3
+ omit =
4
+
5
+ [report]
6
+ show_missing = true
7
+ skip_empty = true
@@ -0,0 +1,86 @@
1
+ *.pyc
2
+ __pycache__/
3
+ *.egg-info/
4
+ .DS_Store
5
+ dist/
6
+ build/
7
+ .venv/
8
+ .demo-ui/
9
+ .demo-ui-mock/
10
+ .env
11
+ .env.local
12
+ .env.*.local
13
+ config.yaml
14
+ !lab/src/mas/lab/templates/**/config.yaml
15
+ !docs/tutorials/**/config.yaml
16
+ !labs/**/config.yaml
17
+ !library-samples/sample-workspace/config.yaml
18
+ .mypy_cache/
19
+ .ruff_cache/
20
+ .pytest_cache/
21
+ .test-venv/
22
+ node_modules/
23
+ *.log
24
+ docs/tutorials/**/logs/
25
+ .hypothesis/
26
+ compliance-report.json
27
+ COMPLIANCE_REPORT.md
28
+ compliance/results/
29
+
30
+ # MkDocs build output
31
+ site/
32
+
33
+ .vscode/
34
+ .cursor/
35
+ .claude/
36
+
37
+ # Test / coverage artifacts
38
+ .coverage
39
+ coverage.xml
40
+ coverage.json
41
+ **/coverage.json
42
+
43
+ # LaTeX build artifacts
44
+ *.fdb_latexmk
45
+ *.fls
46
+ *.aux
47
+ *.out
48
+ *.toc
49
+ *.synctex.gz
50
+
51
+ # Run output / artifacts
52
+ **/output/*.jsonl
53
+ **/output/benchmark
54
+ **/output/meta.json
55
+ **/output/current_run_id.txt
56
+ **/output/*/
57
+ .tutorial-cache/
58
+ tests/.tutorial-engine-cache/
59
+ .demo-cache/
60
+ # Local mas-ctl chat traces next to an agent (fixtures live under fixtures/ or T01 traces/)
61
+ docs/tutorials/**/agents/**/traces/
62
+
63
+ # Backup files
64
+ *.bak
65
+ *.bak2
66
+
67
+ # Legacy dead code (removed from repo)
68
+ lab/src/mas/lab/_cli_legacy.py
69
+ .deepeval/
70
+ ~/.mas/
71
+
72
+
73
+ # Docker local secrets + data (never commit)
74
+ docker/.env
75
+ docker/data/*
76
+ !docker/data/.gitkeep
77
+
78
+ # Local protocol compliance checkouts and reports
79
+ compliance/vendor/
80
+
81
+ # Local harness playbooks (not published)
82
+ AGENTS.md
83
+ # .agents/
84
+ COVERAGE_REPORT.md
85
+ MANIFEST_SCHEMA_MAPPING.md
86
+ .lycheecache
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.5
2
+ Name: mas-lab-component-controller
3
+ Version: 0.2.0
4
+ Summary: MAS Lab controller daemon — workers, IPC, HTTP API for CLI and UI.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: click>=8.0
8
+ Requires-Dist: fastapi>=0.110
9
+ Requires-Dist: mas-lab-component-bench
10
+ Requires-Dist: mas-lab-component-core
11
+ Requires-Dist: mas-lab-ctl
12
+ Requires-Dist: mas-lab-runtime
13
+ Requires-Dist: pydantic>=2.0
14
+ Requires-Dist: python-multipart>=0.0.9
15
+ Requires-Dist: pyyaml>=6.0
16
+ Requires-Dist: uvicorn[standard]>=0.27
17
+ Provides-Extra: dev
18
+ Requires-Dist: httpx>=0.27; extra == 'dev'
19
+ Requires-Dist: pytest-asyncio; extra == 'dev'
20
+ Requires-Dist: pytest-cov>=6.0; extra == 'dev'
21
+ Requires-Dist: pytest>=9.0; extra == 'dev'
@@ -0,0 +1,190 @@
1
+ <!--
2
+ Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # lab/components/controller
6
+
7
+ `lab/components/controller` is the control plane for MAS Lab experiments. It runs long-lived work (benchmarks, agent runs, pipelines) in background workers, exposes a REST API for the web UI, and provides Unix-socket inter-process communication (IPC) for the CLI.
8
+
9
+ Use it when you start experiments through `mas-lab benchmark run` or the `ui/` web app; both talk to this daemon.
10
+
11
+ ```bash
12
+ mas-lab serve # foreground controller; HTTP API on http://localhost:8090
13
+ ```
14
+
15
+ ## Overview
16
+
17
+ | Piece | Role |
18
+ |-------|------|
19
+ | **Daemon** | Long-lived process: worker registry, HTTP server, Unix socket IPC |
20
+ | **Workers** | `benchmark`, `application`, `pipeline` jobs with captured stdout/stderr |
21
+ | **HTTP API** | FastAPI on port 9000 — libraries, CRUD, job submit/poll |
22
+ | **ManifestStore** | Reads/writes lab library YAML (experiments, pipelines, overlays, …) |
23
+ | **ControllerClient** | CLI helper: auto-start daemon, submit jobs, poll workers |
24
+
25
+ The CLI and UI share one job model: submit, receive a `job_id` / `worker_id`, then poll until the state is `completed`, `failed` or `cancelled`. Polling uses REST.
26
+
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ # Full stack (meta-package)
32
+ uv pip install mas-lab
33
+
34
+ # Lab components only
35
+ uv pip install -e ./lab/components/core \
36
+ -e ./lab/components/bench \
37
+ -e ./lab/components/controller
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Quick start
43
+
44
+ ### 1. Start the controller (backend)
45
+
46
+ **Foreground** (recommended for development — logs in terminal):
47
+
48
+ ```bash
49
+ task install # from repo root — installs lab/components/controller into .venv
50
+ mas-lab serve
51
+ # HTTP API → http://localhost:8090 (use --port to change)
52
+ # Unix socket → $XDG_DATA_HOME/mas/controller.sock
53
+ ```
54
+
55
+ **Background daemon** (default HTTP port 9000):
56
+
57
+ ```bash
58
+ mas-lab control start
59
+ mas-lab control status # confirm running + port
60
+ ```
61
+
62
+ Stop: `mas-lab control stop`
63
+
64
+ ### 2. Connect mas-lab-ui (frontend)
65
+
66
+ In the `ui/` directory at the mas-lab repo root:
67
+
68
+ ```bash
69
+ yarn install
70
+ export VITE_API_BASE_URL=http://localhost:8090
71
+ yarn dev
72
+ # Open http://localhost:5173 (Vite default)
73
+ ```
74
+
75
+ The UI calls `/api/libraries/*`, `/api/jobs/*`, `/api/schemas/*`, and related routes.
76
+ Manifest schemas are served from installed packages (`mas-runtime`, `lab/components/bench`,
77
+ `lab/components/core`) — not vendored inside the controller. Contract tests mirror the UI
78
+ surface (`lab/components/controller/tests/test_api_calls_contract.py`).
79
+
80
+ ### 3. Run a benchmark via the daemon
81
+
82
+ All `mas-lab benchmark run` invocations go through the controller:
83
+
84
+ ```bash
85
+ # Blocking: submit + poll + stream stdout/stderr until done
86
+ mas-lab benchmark run my-lab/experiments/smoke.yaml --dry-run
87
+
88
+ # Detached: print worker id and exit
89
+ mas-lab benchmark run my-lab/experiments/smoke.yaml --dry-run -b
90
+
91
+ # Follow a detached worker
92
+ mas-lab worker follow <worker_id>
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Architecture
98
+
99
+ ```text
100
+ ┌─────────────┐ Unix socket ┌──────────────────┐
101
+ │ mas-lab │ ───────────────────► │ Controller │
102
+ │ CLI │ submit_benchmark │ daemon │
103
+ │ │ get_worker (poll) │ │
104
+ └─────────────┘ │ WorkerRegistry │
105
+ │ WorkerRunner │
106
+ ┌─────────────┐ HTTP :9000 │ ManifestStore │
107
+ │ mas-lab-ui │ ───────────────────► │ FastAPI app │
108
+ │ (React) │ /api/jobs/{id} │ schema_registry │
109
+ └─────────────┘ /api/schemas/* └────────┬─────────┘
110
+ polls ──────────────────────────────────┤
111
+ ▼
112
+ benchmark / application / pipeline workers
113
+ (stdout/stderr → pollable buffers)
114
+ ```
115
+
116
+ | Transport | Used by | Typical calls |
117
+ |-----------|---------|---------------|
118
+ | Unix socket | CLI | `submit_benchmark`, `get_worker`, `cancel_worker`, `ping` |
119
+ | HTTP REST | UI | `POST /api/libraries/{lib}/benchmark/run`, `GET /api/jobs/{id}` |
120
+
121
+ Environment variables (defaults):
122
+
123
+ | Variable | Default | Purpose |
124
+ |----------|---------|---------|
125
+ | `MAS_HOME` | `$XDG_DATA_HOME/mas` | Config and socket parent dir |
126
+ | `MAS_CONTROLLER_SOCKET` | `$XDG_DATA_HOME/mas/controller.sock` | Unix socket path |
127
+ | `MAS_CONTROLLER_PORT` | `9000` | HTTP API port |
128
+
129
+ ---
130
+
131
+ ## CLI commands
132
+
133
+ ```bash
134
+ mas-lab control start|stop|status|restart # daemon lifecycle
135
+ mas-lab worker list [--kind benchmark] # list workers
136
+ mas-lab worker show <id> # JSON detail
137
+ mas-lab worker follow <id> # poll + stream until done
138
+ mas-lab worker cancel <id>
139
+ mas-lab serve # foreground controller + HTTP
140
+ ```
141
+
142
+ Benchmark and application runs are submitted through the daemon automatically;
143
+ see [lab/components/bench](../bench/README.md) for experiment YAML format.
144
+
145
+ ---
146
+
147
+ ## Package layout
148
+
149
+ ```
150
+ components/controller/src/mas/lab/controller/
151
+ ├── daemon.py # Main loop: socket IPC + HTTP
152
+ ├── fastapi_app.py # REST API (mas-lab-ui contract)
153
+ ├── api.py # ControllerAPI (libraries, workers, manifests)
154
+ ├── client.py # ControllerClient, follow_worker, start_daemon
155
+ ├── workers.py # Benchmark / application / pipeline workers
156
+ ├── io_capture.py # Redirect stdout/stderr into worker records
157
+ ├── manifest_store.py # Lab library CRUD on disk
158
+ ├── registry.py # WorkerRegistry
159
+ ├── cli.py # mas-lab control / worker commands
160
+ ├── schema_registry.py # Resolve schemas from mas-runtime / bench / core packages
161
+ └── schemas/ # Controller-local pipeline step-type registry only
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Documentation
167
+
168
+ ### User documentation
169
+
170
+ | Document | Description |
171
+ |----------|-------------|
172
+ | [../../docs/user-guide.md](../../docs/user-guide.md) | End-to-end MAS Lab user guide |
173
+ | [../../docs/benchmark.md](../../docs/benchmark.md) | Benchmark quickstart and lifecycle |
174
+
175
+ ### Developer documentation
176
+
177
+ | Document | Description |
178
+ |----------|-------------|
179
+ | [../../../docs/references/schemas.md](../../../docs/references/schemas.md) | Package-owned schemas, `/api/schemas`, UI vs runtime |
180
+ | [../../../runtime/docs/dev/schemas/agent-manifest.md](../../../runtime/docs/dev/schemas/agent-manifest.md) | Runtime agent manifest reference |
181
+ | [../../../runtime/docs/dev/schemas/mas-topology.md](../../../runtime/docs/dev/schemas/mas-topology.md) | MAS topology / workflow reference |
182
+ | [../bench/README.md](../bench/README.md) | Experiment and post-processing pipeline YAML |
183
+
184
+ ### Related components
185
+
186
+ | Component | README |
187
+ |-----------|--------|
188
+ | `lab/components/core` | [../core/README.md](../core/README.md) |
189
+ | `lab/components/bench` | [../bench/README.md](../bench/README.md) |
190
+ | `mas-lab-ui` | [mas-lab-ui README](https://github.com/mas-framework/mas-lab-ui) |
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ [build-system]
4
+ requires = ["hatchling"]
5
+ build-backend = "hatchling.build"
6
+
7
+ [project]
8
+ name = "mas-lab-component-controller"
9
+ version = "0.2.0"
10
+ description = "MAS Lab controller daemon — workers, IPC, HTTP API for CLI and UI."
11
+ requires-python = ">=3.11"
12
+ license = {text = "Apache-2.0"}
13
+
14
+ dependencies = [
15
+ "mas-lab-component-core",
16
+ "mas-lab-component-bench",
17
+ "mas-lab-runtime",
18
+ "mas-lab-ctl",
19
+ "click>=8.0",
20
+ "pyyaml>=6.0",
21
+ "fastapi>=0.110",
22
+ "python-multipart>=0.0.9",
23
+ "uvicorn[standard]>=0.27",
24
+ "pydantic>=2.0",
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=9.0",
30
+ "pytest-asyncio",
31
+ "pytest-cov>=6.0",
32
+ "httpx>=0.27",
33
+ ]
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/mas"]
37
+
38
+ [project.entry-points."mas.lab.cli.components"]
39
+ controller = "mas.lab.controller.cli:ControllerCliComponent"
@@ -0,0 +1,7 @@
1
+ # Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """MAS Lab controller — daemon, workers, and HTTP API."""
4
+ from mas.lab.controller.api import ControllerAPI
5
+ from mas.lab.controller.lab_registry import LabRegistry, get_lab_registry
6
+
7
+ __all__ = ["ControllerAPI", "LabRegistry", "get_lab_registry"]
@@ -0,0 +1,5 @@
1
+ # Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # Reference entry point for running the controller HTTP API directly (PR #5).
4
+ # Prefer: mas-lab control start or mas-lab serve
5
+ from mas.lab.controller.fastapi_app import app # noqa: F401
@@ -0,0 +1,226 @@
1
+ # Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """In-process agent chat for the controller UI.
4
+
5
+ Runs agents via v2 ``SessionController`` (no subprocess / stdout capture) and
6
+ returns structured interaction fields: user query in, agent response or error out.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import logging
11
+ import re
12
+ import uuid
13
+ from dataclasses import dataclass
14
+ from pathlib import Path
15
+ from typing import Literal, Optional
16
+
17
+ import yaml
18
+
19
+ logger = logging.getLogger(__name__)
20
+
21
+ _STATUS = Literal["ok", "error"]
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class AgentTurnResult:
26
+ status: _STATUS
27
+ response: str = ""
28
+ error_message: str = ""
29
+ error_detail: str = ""
30
+ session_id: str = ""
31
+
32
+
33
+ def format_error(raw: str) -> tuple[str, str]:
34
+ """Return (short_message, full_detail) from a raw agent/LLM error string."""
35
+ full = (raw or "").strip()
36
+ if not full:
37
+ return "Agent execution failed.", ""
38
+
39
+ short = full
40
+
41
+ msg_match = re.search(r"['\"]message['\"]\s*:\s*['\"]([^'\"]+)['\"]", full)
42
+ if msg_match:
43
+ short = msg_match.group(1)
44
+ elif "ExceededBudget" in full:
45
+ budget_match = re.search(r"(ExceededBudget:[^\n'\"]+)", full)
46
+ if budget_match:
47
+ short = budget_match.group(1).strip()
48
+
49
+ if len(short) > 240:
50
+ short = short[:237] + "..."
51
+
52
+ return short, full
53
+
54
+
55
+ class _SilentDisplay:
56
+ """No-op conversation display for embedded UI turns."""
57
+
58
+ def on_user(self, text: str, *, turn_id: str = "") -> None:
59
+ return
60
+
61
+ def on_agent(self, text: str) -> None:
62
+ return
63
+
64
+ def on_turn_error(self, message: str, *, detail: str = "") -> None:
65
+ return
66
+
67
+ def on_hitl_request(self, request: object) -> None:
68
+ return
69
+
70
+ def on_working(self, message: str = "Agent working…") -> None:
71
+ return
72
+
73
+ def end_working(self) -> None:
74
+ return
75
+
76
+ def on_system(self, message: str) -> None:
77
+ return
78
+
79
+ def on_error(self, message: str) -> None:
80
+ return
81
+
82
+
83
+ def _load_workspace_dotenv(base_dir: Path) -> None:
84
+ """Load optional .env files; container env from docker/.env still wins (override=False)."""
85
+ import os
86
+
87
+ try:
88
+ from dotenv import load_dotenv
89
+ except ImportError:
90
+ return
91
+
92
+ candidates = [
93
+ Path("/workspace/.env"),
94
+ base_dir / ".env",
95
+ Path(os.environ.get("MAS_WORKSPACE_ROOT", "")) / ".env",
96
+ ]
97
+ for path in candidates:
98
+ if path.is_file():
99
+ load_dotenv(path, override=False)
100
+
101
+
102
+ def _quiet_logging_for_chat() -> None:
103
+ """Suppress exchange logs; UI chat must not capture CLI-style stdout."""
104
+ import os
105
+
106
+ from mas.ctl.logging_setup import setup_logging
107
+
108
+ os.environ.pop("LOG_LEVEL", None)
109
+ setup_logging(verbosity=0)
110
+ logging.getLogger("mas.runtime").setLevel(logging.WARNING)
111
+ logging.getLogger("mas.ctl").setLevel(logging.WARNING)
112
+
113
+
114
+ def run_agent_turn(
115
+ manifest_yaml: str,
116
+ query: str,
117
+ *,
118
+ base_dir: Path,
119
+ flavour: Optional[str] = None,
120
+ session_id: Optional[str] = None,
121
+ ) -> AgentTurnResult:
122
+ """Execute one user → agent turn in-process via v2 SessionController."""
123
+ from mas.ctl.infra.resolve import resolve_infra_refs
124
+ from mas.ctl.runtime_cli import pattern_from_manifest
125
+ from mas.ctl.session.bootstrap import InstantiationOptions, instantiate_runtime
126
+ from mas.ctl.session.controller import ConversationConfig, SessionController
127
+ from mas.ctl.session.hitl_config import resolve_hitl_from_manifest
128
+ from mas.ctl.ui.turn_result import turn_to_agent_result
129
+ from mas.ctl.workspace.config import (
130
+ UserConfig,
131
+ WorkspaceConfig,
132
+ merge_infra_interceptors,
133
+ merge_infra_refs,
134
+ )
135
+
136
+ _quiet_logging_for_chat()
137
+ _load_workspace_dotenv(base_dir)
138
+
139
+ base_dir = Path(base_dir)
140
+ sid = session_id or f"ui:{uuid.uuid4()}"
141
+ prompt = (query or "").strip()
142
+ if not prompt:
143
+ return AgentTurnResult(
144
+ status="error",
145
+ error_message="No query provided.",
146
+ session_id=sid,
147
+ )
148
+
149
+ try:
150
+ current_manifest = yaml.safe_load(manifest_yaml)
151
+ except yaml.YAMLError as exc:
152
+ return AgentTurnResult(
153
+ status="error",
154
+ error_message=f"Invalid manifest YAML: {exc}",
155
+ error_detail=str(exc),
156
+ session_id=sid,
157
+ )
158
+
159
+ if not isinstance(current_manifest, dict):
160
+ return AgentTurnResult(
161
+ status="error",
162
+ error_message="Manifest must be a YAML mapping.",
163
+ session_id=sid,
164
+ )
165
+
166
+ try:
167
+ workspace = WorkspaceConfig.load(base_dir)
168
+ user = UserConfig.load()
169
+ pattern = pattern_from_manifest(current_manifest)
170
+ merged_infra = merge_infra_refs(
171
+ workspace_refs=workspace.effective_infra_refs,
172
+ user_refs=[user.default_infra] if user.default_infra else [],
173
+ cli_refs=[],
174
+ workspace_found=workspace.found,
175
+ )
176
+ resolved_infra = resolve_infra_refs(
177
+ merged_infra,
178
+ anchor=base_dir,
179
+ workspace=workspace,
180
+ user=user,
181
+ interceptors=merge_infra_interceptors(
182
+ workspace_interceptors=workspace.infra_interceptors,
183
+ cli_interceptors=[],
184
+ ),
185
+ )
186
+ hitl_responder, hitl_terminal = resolve_hitl_from_manifest(
187
+ current_manifest, session_interactive=False
188
+ )
189
+ instance, _store = instantiate_runtime(
190
+ InstantiationOptions(
191
+ pattern_plugin_id=pattern,
192
+ agent_manifest=current_manifest,
193
+ manifest_dir=base_dir,
194
+ resolved_infra=resolved_infra,
195
+ workspace=workspace,
196
+ validate_manifests=False,
197
+ ),
198
+ hitl=hitl_responder,
199
+ )
200
+ controller = SessionController(
201
+ instance=instance,
202
+ display=_SilentDisplay(),
203
+ hitl_terminal=hitl_terminal,
204
+ config=ConversationConfig(single_turn=True),
205
+ verbose=0,
206
+ session_id=sid,
207
+ )
208
+ turn = controller.run_turn(prompt, turn_id=sid, auto_hitl=True)
209
+ mapped = turn_to_agent_result(turn)
210
+ except Exception as exc:
211
+ logger.debug("Agent session failed", exc_info=True)
212
+ short, full = format_error(str(exc))
213
+ return AgentTurnResult(
214
+ status="error",
215
+ error_message=short,
216
+ error_detail=full,
217
+ session_id=sid,
218
+ )
219
+
220
+ return AgentTurnResult(
221
+ status=mapped.status,
222
+ response=mapped.response,
223
+ error_message=mapped.error_message,
224
+ error_detail=mapped.error_detail,
225
+ session_id=sid,
226
+ )