lightfall 0.1.1__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.
- lightfall/__init__.py +8 -0
- lightfall/__main__.py +10 -0
- lightfall/_version.py +24 -0
- lightfall/acquire/__init__.py +74 -0
- lightfall/acquire/buffer.py +363 -0
- lightfall/acquire/device_wrapper.py +416 -0
- lightfall/acquire/engine/__init__.py +155 -0
- lightfall/acquire/engine/base.py +587 -0
- lightfall/acquire/engine/bluesky.py +358 -0
- lightfall/acquire/engine/mock.py +165 -0
- lightfall/acquire/engine/plugins/__init__.py +9 -0
- lightfall/acquire/engine/plugins/bluesky_plugin.py +56 -0
- lightfall/acquire/engine/plugins/mock_plugin.py +55 -0
- lightfall/acquire/engine/protocol.py +145 -0
- lightfall/acquire/engine/registry.py +152 -0
- lightfall/acquire/engine/state.py +32 -0
- lightfall/acquire/engine/waiting_hook.py +225 -0
- lightfall/acquire/nats_bridge.py +62 -0
- lightfall/acquire/plan_ui.py +78 -0
- lightfall/acquire/plans/__init__.py +38 -0
- lightfall/acquire/plans/adaptive.py +288 -0
- lightfall/acquire/plans/example_plans.py +995 -0
- lightfall/acquire/plans/lightfall_plans.py +587 -0
- lightfall/acquire/plans/registry.py +543 -0
- lightfall/acquire/plans/standard_plans.py +186 -0
- lightfall/acquire/plans/user_plans.py +470 -0
- lightfall/acquire/runengine.py +36 -0
- lightfall/acquire/signals.py +452 -0
- lightfall/acquire/triggers/__init__.py +16 -0
- lightfall/acquire/triggers/base.py +25 -0
- lightfall/acquire/triggers/filter.py +37 -0
- lightfall/acquire/triggers/manager.py +73 -0
- lightfall/acquire/triggers/manual.py +36 -0
- lightfall/acquire/triggers/run_end.py +74 -0
- lightfall/acquire/triggers/run_start.py +52 -0
- lightfall/auth/__init__.py +38 -0
- lightfall/auth/policy.py +518 -0
- lightfall/auth/providers/__init__.py +30 -0
- lightfall/auth/providers/base.py +124 -0
- lightfall/auth/providers/keycloak.py +1017 -0
- lightfall/auth/providers/local.py +319 -0
- lightfall/auth/providers/pam.py +250 -0
- lightfall/auth/service_key.py +173 -0
- lightfall/auth/service_key_auth.py +79 -0
- lightfall/auth/session.py +656 -0
- lightfall/claude/__init__.py +52 -0
- lightfall/claude/_internal/__init__.py +1 -0
- lightfall/claude/_internal/serialization.py +195 -0
- lightfall/claude/_internal/threading.py +61 -0
- lightfall/claude/_internal/worker.py +757 -0
- lightfall/claude/_session_assembly.py +124 -0
- lightfall/claude/agent.py +596 -0
- lightfall/claude/lightfall_core_tools.py +410 -0
- lightfall/claude/markdown.py +103 -0
- lightfall/claude/permission_manager.py +588 -0
- lightfall/claude/tools/__init__.py +45 -0
- lightfall/claude/tools/controller.py +143 -0
- lightfall/claude/tools/interaction.py +177 -0
- lightfall/claude/tools/introspection.py +127 -0
- lightfall/claude/tools/logs.py +155 -0
- lightfall/claude/tools/screenshot.py +87 -0
- lightfall/claude/widget.py +851 -0
- lightfall/claude/widgets/__init__.py +5 -0
- lightfall/claude/widgets/permission_request.py +282 -0
- lightfall/claude/widgets/question_request.py +227 -0
- lightfall/claude/widgets/task_card.py +223 -0
- lightfall/config/__init__.py +23 -0
- lightfall/config/layers.py +317 -0
- lightfall/config/manager.py +244 -0
- lightfall/config/schema.py +154 -0
- lightfall/core/__init__.py +23 -0
- lightfall/core/application.py +727 -0
- lightfall/core/services.py +235 -0
- lightfall/devices/__init__.py +53 -0
- lightfall/devices/backends/__init__.py +17 -0
- lightfall/devices/backends/bcs.py +448 -0
- lightfall/devices/backends/happi.py +986 -0
- lightfall/devices/backends/mock.py +646 -0
- lightfall/devices/base.py +338 -0
- lightfall/devices/catalog.py +1039 -0
- lightfall/devices/connection_manager.py +676 -0
- lightfall/devices/model.py +290 -0
- lightfall/devices/monitoring.py +442 -0
- lightfall/devices/sim/__init__.py +26 -0
- lightfall/devices/sim/areadetector.py +436 -0
- lightfall/devices/sim/generators.py +223 -0
- lightfall/devices/sim/plugins.py +116 -0
- lightfall/epics/__init__.py +28 -0
- lightfall/epics/ca/__init__.py +10 -0
- lightfall/epics/ca/context.py +100 -0
- lightfall/epics/ca/pv.py +303 -0
- lightfall/epics/widgets/__init__.py +49 -0
- lightfall/epics/widgets/areadetector/__init__.py +16 -0
- lightfall/epics/widgets/areadetector/areadetector.py +281 -0
- lightfall/epics/widgets/areadetector/controls.py +478 -0
- lightfall/epics/widgets/areadetector/image_view.py +447 -0
- lightfall/epics/widgets/auto.py +319 -0
- lightfall/epics/widgets/base.py +404 -0
- lightfall/epics/widgets/checkbox.py +239 -0
- lightfall/epics/widgets/combobox.py +202 -0
- lightfall/epics/widgets/label.py +176 -0
- lightfall/epics/widgets/lineedit.py +253 -0
- lightfall/epics/widgets/motor.py +694 -0
- lightfall/epics/widgets/ophyd_base.py +469 -0
- lightfall/epics/widgets/ophyd_combobox.py +86 -0
- lightfall/epics/widgets/ophyd_label.py +54 -0
- lightfall/epics/widgets/ophyd_lineedit.py +170 -0
- lightfall/epics/widgets/ophyd_spinbox.py +79 -0
- lightfall/epics/widgets/slider.py +272 -0
- lightfall/epics/widgets/status_indicator.py +98 -0
- lightfall/epics/widgets/style.py +188 -0
- lightfall/exporter/__init__.py +1 -0
- lightfall/exporter/cli.py +67 -0
- lightfall/exporter/converters/__init__.py +26 -0
- lightfall/exporter/converters/base.py +39 -0
- lightfall/exporter/converters/noop.py +39 -0
- lightfall/exporter/converters/nxsas.py +73 -0
- lightfall/exporter/service.py +200 -0
- lightfall/exporter/tiled_utils.py +92 -0
- lightfall/ipc/__init__.py +6 -0
- lightfall/ipc/service.py +701 -0
- lightfall/ipc/trust.py +144 -0
- lightfall/logbook/__init__.py +46 -0
- lightfall/logbook/action_dialog.py +207 -0
- lightfall/logbook/action_logger.py +432 -0
- lightfall/logbook/block_mapper.py +562 -0
- lightfall/logbook/client.py +799 -0
- lightfall/logbook/converter.py +273 -0
- lightfall/logbook/editors/__init__.py +19 -0
- lightfall/logbook/editors/highlighter.py +305 -0
- lightfall/logbook/editors/markdown_editor.py +319 -0
- lightfall/logbook/editors/richtext_editor.py +1397 -0
- lightfall/logbook/entry_widget.py +1065 -0
- lightfall/logbook/event_listener.py +221 -0
- lightfall/logbook/fragment_widgets.py +925 -0
- lightfall/logbook/position_mapper.py +320 -0
- lightfall/logbook/protection.py +402 -0
- lightfall/logbook/style.py +394 -0
- lightfall/logbook/url.py +29 -0
- lightfall/logbook/visual_protection.py +330 -0
- lightfall/logbook/widget.py +680 -0
- lightfall/main.py +1091 -0
- lightfall/pipelines/__init__.py +4 -0
- lightfall/pipelines/client.py +148 -0
- lightfall/plugins/__init__.py +119 -0
- lightfall/plugins/agent_plugin.py +106 -0
- lightfall/plugins/agents/__init__.py +10 -0
- lightfall/plugins/agents/_mcp_helpers.py +52 -0
- lightfall/plugins/agents/alignment.py +94 -0
- lightfall/plugins/agents/autonomous_experiment/__init__.py +12 -0
- lightfall/plugins/agents/autonomous_experiment/nats_tools.py +210 -0
- lightfall/plugins/agents/autonomous_experiment/plugin.py +60 -0
- lightfall/plugins/agents/autonomous_experiment/prompts.py +164 -0
- lightfall/plugins/agents/current_esaf.py +435 -0
- lightfall/plugins/agents/device_tools.py +1043 -0
- lightfall/plugins/agents/engine_tools.py +720 -0
- lightfall/plugins/agents/ipython_tools.py +444 -0
- lightfall/plugins/agents/panel_builder.py +637 -0
- lightfall/plugins/agents/panel_design/references/cross_panel_patterns.md +95 -0
- lightfall/plugins/agents/panel_design/references/panel_design.md +680 -0
- lightfall/plugins/agents/panel_design.py +94 -0
- lightfall/plugins/agents/plan_design/references/plan_design.md +398 -0
- lightfall/plugins/agents/plan_design.py +90 -0
- lightfall/plugins/agents/plan_tools.py +878 -0
- lightfall/plugins/agents/scan_planning.py +101 -0
- lightfall/plugins/builtin_manifest.py +348 -0
- lightfall/plugins/controller_plugin.py +162 -0
- lightfall/plugins/engine_plugin.py +124 -0
- lightfall/plugins/errors.py +104 -0
- lightfall/plugins/info.py +112 -0
- lightfall/plugins/loader.py +878 -0
- lightfall/plugins/manifest.py +150 -0
- lightfall/plugins/panel_plugin.py +119 -0
- lightfall/plugins/plan_plugin.py +163 -0
- lightfall/plugins/registry.py +309 -0
- lightfall/plugins/settings_plugin.py +226 -0
- lightfall/plugins/statusbar_plugin.py +289 -0
- lightfall/plugins/theme_plugin.py +165 -0
- lightfall/plugins/types.py +136 -0
- lightfall/plugins/user_plugins.py +764 -0
- lightfall/project/__init__.py +37 -0
- lightfall/project/model.py +375 -0
- lightfall/project/service.py +427 -0
- lightfall/project/welcome.py +106 -0
- lightfall/resources/__init__.py +126 -0
- lightfall/resources/images/__init__.py +1 -0
- lightfall/resources/images/icon.ico +0 -0
- lightfall/resources/images/icon.png +0 -0
- lightfall/resources/images/logo.png +0 -0
- lightfall/services/__init__.py +33 -0
- lightfall/services/_alshub_client.py +73 -0
- lightfall/services/access_stamper.py +240 -0
- lightfall/services/als_beam_status.py +347 -0
- lightfall/services/ca_tunnel.py +325 -0
- lightfall/services/threaded_tiled_writer.py +174 -0
- lightfall/services/tiled_auth.py +21 -0
- lightfall/services/tiled_service.py +971 -0
- lightfall/services/tiled_writer_patch.py +301 -0
- lightfall/settings/__init__.py +1 -0
- lightfall/settings/image_helpers.py +30 -0
- lightfall/settings/user_settings_client.py +232 -0
- lightfall/ui/__init__.py +28 -0
- lightfall/ui/annotations.py +208 -0
- lightfall/ui/common/__init__.py +7 -0
- lightfall/ui/dialogs/__init__.py +26 -0
- lightfall/ui/dialogs/about_dialog.py +131 -0
- lightfall/ui/dialogs/add_trigger_dialog.py +152 -0
- lightfall/ui/dialogs/base.py +44 -0
- lightfall/ui/dialogs/bug_report_dialog.py +353 -0
- lightfall/ui/dialogs/create_plan_dialog.py +189 -0
- lightfall/ui/dialogs/device_edit_dialog.py +183 -0
- lightfall/ui/dialogs/export_dialog.py +565 -0
- lightfall/ui/dialogs/go_to_position_dialog.py +192 -0
- lightfall/ui/dialogs/login_dialog.py +756 -0
- lightfall/ui/dialogs/oauth_browser_dialog.py +305 -0
- lightfall/ui/dialogs/run_pipeline_dialog.py +131 -0
- lightfall/ui/dialogs/sample_metadata_dialog.py +316 -0
- lightfall/ui/docking/__init__.py +22 -0
- lightfall/ui/docking/icon_sidebar.py +806 -0
- lightfall/ui/docking/manager.py +682 -0
- lightfall/ui/docking/state.py +113 -0
- lightfall/ui/docking/theme.py +399 -0
- lightfall/ui/docking/widget.py +214 -0
- lightfall/ui/events.py +75 -0
- lightfall/ui/mainwindow.py +1006 -0
- lightfall/ui/models/__init__.py +49 -0
- lightfall/ui/models/device_selection.py +389 -0
- lightfall/ui/models/device_tree.py +1095 -0
- lightfall/ui/models/thread_model.py +667 -0
- lightfall/ui/models/tiled_model.py +384 -0
- lightfall/ui/panels/__init__.py +28 -0
- lightfall/ui/panels/base.py +525 -0
- lightfall/ui/panels/bluesky_panel.py +619 -0
- lightfall/ui/panels/claude/__init__.py +9 -0
- lightfall/ui/panels/claude/agent_registry.py +168 -0
- lightfall/ui/panels/claude_panel.py +887 -0
- lightfall/ui/panels/device_panel.py +370 -0
- lightfall/ui/panels/documents_panel.py +166 -0
- lightfall/ui/panels/ipython_panel.py +580 -0
- lightfall/ui/panels/logbook_entries_panel.py +84 -0
- lightfall/ui/panels/logbook_panel.py +627 -0
- lightfall/ui/panels/logging_panel.py +587 -0
- lightfall/ui/panels/pipeline_jobs_panel.py +160 -0
- lightfall/ui/panels/pipeline_triggers_panel.py +170 -0
- lightfall/ui/panels/plugins/__init__.py +34 -0
- lightfall/ui/panels/plugins/bluesky_plugin.py +27 -0
- lightfall/ui/panels/plugins/claude_plugin.py +29 -0
- lightfall/ui/panels/plugins/device_plugin.py +27 -0
- lightfall/ui/panels/plugins/documents_plugin.py +26 -0
- lightfall/ui/panels/plugins/ipython_plugin.py +27 -0
- lightfall/ui/panels/plugins/logbook_entries_plugin.py +23 -0
- lightfall/ui/panels/plugins/logbook_plugin.py +27 -0
- lightfall/ui/panels/plugins/logging_plugin.py +27 -0
- lightfall/ui/panels/plugins/pipeline_jobs_plugin.py +23 -0
- lightfall/ui/panels/plugins/pipeline_triggers_plugin.py +25 -0
- lightfall/ui/panels/plugins/queue_plugin.py +29 -0
- lightfall/ui/panels/plugins/synoptic_plugin.py +38 -0
- lightfall/ui/panels/plugins/threads_plugin.py +27 -0
- lightfall/ui/panels/plugins/tiled_browser_plugin.py +27 -0
- lightfall/ui/panels/plugins/visualization_plugin.py +27 -0
- lightfall/ui/panels/queue.py +754 -0
- lightfall/ui/panels/registry.py +483 -0
- lightfall/ui/panels/synoptic/__init__.py +27 -0
- lightfall/ui/panels/synoptic/editors.py +481 -0
- lightfall/ui/panels/synoptic/items.py +556 -0
- lightfall/ui/panels/synoptic/models.py +336 -0
- lightfall/ui/panels/synoptic/panel.py +889 -0
- lightfall/ui/panels/synoptic/serialization.py +300 -0
- lightfall/ui/panels/synoptic/view.py +504 -0
- lightfall/ui/panels/threads_panel.py +621 -0
- lightfall/ui/panels/tiled_browser_panel.py +854 -0
- lightfall/ui/panels/visualization_panel.py +508 -0
- lightfall/ui/preferences/__init__.py +24 -0
- lightfall/ui/preferences/backend.py +148 -0
- lightfall/ui/preferences/builtin.py +220 -0
- lightfall/ui/preferences/claude_settings.py +762 -0
- lightfall/ui/preferences/device_settings.py +461 -0
- lightfall/ui/preferences/dialog.py +234 -0
- lightfall/ui/preferences/editor_settings.py +227 -0
- lightfall/ui/preferences/ipc_settings.py +226 -0
- lightfall/ui/preferences/logbook_settings.py +232 -0
- lightfall/ui/preferences/login_settings.py +183 -0
- lightfall/ui/preferences/manager.py +562 -0
- lightfall/ui/preferences/plugin_settings.py +392 -0
- lightfall/ui/preferences/proxy_settings.py +561 -0
- lightfall/ui/preferences/skill_settings.py +28 -0
- lightfall/ui/preferences/tiled_settings.py +469 -0
- lightfall/ui/preferences/tool_settings.py +393 -0
- lightfall/ui/preferences/user_portable_backend.py +131 -0
- lightfall/ui/preferences/user_profile_settings.py +316 -0
- lightfall/ui/preferences/visualization_settings.py +159 -0
- lightfall/ui/resources/__init__.py +1 -0
- lightfall/ui/resources/logo.png +0 -0
- lightfall/ui/statusbar/__init__.py +11 -0
- lightfall/ui/statusbar/manager.py +379 -0
- lightfall/ui/statusbar/plugins/__init__.py +28 -0
- lightfall/ui/statusbar/plugins/als_beam_status.py +218 -0
- lightfall/ui/statusbar/plugins/auth_status.py +116 -0
- lightfall/ui/statusbar/plugins/connection_status.py +100 -0
- lightfall/ui/statusbar/plugins/thread_status.py +556 -0
- lightfall/ui/statusbar/plugins/tiled_status.py +179 -0
- lightfall/ui/statusbar/plugins/user_status.py +84 -0
- lightfall/ui/theater/__init__.py +28 -0
- lightfall/ui/theater/manager.py +124 -0
- lightfall/ui/theater/overlay.py +279 -0
- lightfall/ui/theater/proxy.py +111 -0
- lightfall/ui/theme/__init__.py +18 -0
- lightfall/ui/theme/builtin.py +1015 -0
- lightfall/ui/theme/manager.py +875 -0
- lightfall/ui/theme/registry.py +195 -0
- lightfall/ui/toast.py +221 -0
- lightfall/ui/tutorial.py +1100 -0
- lightfall/ui/widgets/__init__.py +110 -0
- lightfall/ui/widgets/base_control.py +259 -0
- lightfall/ui/widgets/camera/__init__.py +36 -0
- lightfall/ui/widgets/camera/base.py +815 -0
- lightfall/ui/widgets/camera/dark_frames.py +213 -0
- lightfall/ui/widgets/camera/image_view.py +649 -0
- lightfall/ui/widgets/camera/panels/__init__.py +14 -0
- lightfall/ui/widgets/camera/panels/cooler.py +320 -0
- lightfall/ui/widgets/camera/panels/temperature.py +192 -0
- lightfall/ui/widgets/camera/plan_based.py +202 -0
- lightfall/ui/widgets/compact_motor.py +522 -0
- lightfall/ui/widgets/controller_matcher.py +278 -0
- lightfall/ui/widgets/controller_registry.py +144 -0
- lightfall/ui/widgets/device_control.py +411 -0
- lightfall/ui/widgets/device_selector.py +438 -0
- lightfall/ui/widgets/device_tree_tab.py +461 -0
- lightfall/ui/widgets/document_stream.py +1028 -0
- lightfall/ui/widgets/favorites_tab.py +191 -0
- lightfall/ui/widgets/motor_control.py +1120 -0
- lightfall/ui/widgets/observers/__init__.py +8 -0
- lightfall/ui/widgets/observers/camera.py +48 -0
- lightfall/ui/widgets/observers/image_view.py +130 -0
- lightfall/ui/widgets/plan_config.py +954 -0
- lightfall/ui/widgets/plan_edit_dialog.py +294 -0
- lightfall/ui/widgets/plan_selector.py +452 -0
- lightfall/ui/widgets/profile_avatar.py +128 -0
- lightfall/ui/widgets/queue_view.py +647 -0
- lightfall/ui/widgets/runengine_control.py +549 -0
- lightfall/ui/widgets/signal_control.py +793 -0
- lightfall/ui/widgets/skill_trigger_button.py +183 -0
- lightfall/ui/widgets/tiled_filter_widget.py +314 -0
- lightfall/ui/widgets/tiled_status.py +149 -0
- lightfall/ui/widgets/warning_banner.py +185 -0
- lightfall/utils/__init__.py +53 -0
- lightfall/utils/crash_diagnostics.py +454 -0
- lightfall/utils/data_migration.py +22 -0
- lightfall/utils/editor_launcher.py +594 -0
- lightfall/utils/error_collector.py +245 -0
- lightfall/utils/git_tracker.py +197 -0
- lightfall/utils/log_buffer.py +233 -0
- lightfall/utils/logging.py +229 -0
- lightfall/utils/module_resolver.py +70 -0
- lightfall/utils/sentry.py +722 -0
- lightfall/utils/threads.py +991 -0
- lightfall/utils/tiled_helpers.py +96 -0
- lightfall/visualization/__init__.py +50 -0
- lightfall/visualization/base.py +5 -0
- lightfall/visualization/base_visualization.py +74 -0
- lightfall/visualization/fitting/__init__.py +24 -0
- lightfall/visualization/fitting/base.py +267 -0
- lightfall/visualization/fitting/fitters.py +325 -0
- lightfall/visualization/fitting/panel.py +265 -0
- lightfall/visualization/memory.py +392 -0
- lightfall/visualization/motor_mixin.py +524 -0
- lightfall/visualization/pg.py +156 -0
- lightfall/visualization/registry.py +144 -0
- lightfall/visualization/spec.py +79 -0
- lightfall/visualization/theme.py +266 -0
- lightfall/visualization/widgets/__init__.py +28 -0
- lightfall/visualization/widgets/adaptive/__init__.py +1 -0
- lightfall/visualization/widgets/adaptive/heatmap.py +655 -0
- lightfall/visualization/widgets/adaptive/plot.py +233 -0
- lightfall/visualization/widgets/heatmap.py +264 -0
- lightfall/visualization/widgets/image_stack.py +316 -0
- lightfall/visualization/widgets/image_view_toolbar.py +227 -0
- lightfall/visualization/widgets/lazy_image_view.py +590 -0
- lightfall/visualization/widgets/plot_1d.py +262 -0
- lightfall/visualization/widgets/scatter.py +247 -0
- lightfall/visualization/widgets/table.py +221 -0
- lightfall/visualization/widgets/time_axis.py +93 -0
- lightfall-0.1.1.dist-info/METADATA +223 -0
- lightfall-0.1.1.dist-info/RECORD +388 -0
- lightfall-0.1.1.dist-info/WHEEL +4 -0
- lightfall-0.1.1.dist-info/entry_points.txt +6 -0
- lightfall-0.1.1.dist-info/licenses/LEGAL.md +13 -0
- lightfall-0.1.1.dist-info/licenses/LICENSE.md +33 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""Scan planning skill plugin.
|
|
2
|
+
|
|
3
|
+
Provides Claude with expertise for planning and configuring data acquisition scans.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from lightfall.plugins.agent_plugin import AgentPlugin
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ScanPlanningAgent(AgentPlugin):
|
|
14
|
+
"""Skill for planning and configuring scans.
|
|
15
|
+
|
|
16
|
+
This skill provides Claude with domain expertise for:
|
|
17
|
+
- Scan type selection and configuration
|
|
18
|
+
- Parameter optimization
|
|
19
|
+
- Time estimation
|
|
20
|
+
- Data collection strategies
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def name(self) -> str:
|
|
25
|
+
"""Return unique identifier for this skill."""
|
|
26
|
+
return "scan_planning"
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def display_name(self) -> str:
|
|
30
|
+
"""Return human-readable display name."""
|
|
31
|
+
return "Scan Planning"
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def description(self) -> str:
|
|
35
|
+
"""Return description of this skill's capabilities."""
|
|
36
|
+
return "Expertise in planning and configuring data acquisition scans"
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def category(self) -> str:
|
|
40
|
+
"""Return category for grouping in settings UI."""
|
|
41
|
+
return "analysis"
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def enabled_by_default(self) -> bool:
|
|
45
|
+
"""Return whether this skill is enabled by default."""
|
|
46
|
+
return True
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def priority(self) -> int:
|
|
50
|
+
"""Return priority (lower = higher in prompt order)."""
|
|
51
|
+
return 20
|
|
52
|
+
|
|
53
|
+
def get_system_prompt(self) -> str:
|
|
54
|
+
"""Return the system prompt snippet for scan planning expertise."""
|
|
55
|
+
return """
|
|
56
|
+
## Scan Planning Expertise
|
|
57
|
+
|
|
58
|
+
When helping with scan planning and data acquisition:
|
|
59
|
+
|
|
60
|
+
### Scan Type Selection
|
|
61
|
+
- **Linear scans**: Best for simple parameter sweeps, characterization
|
|
62
|
+
- **Grid scans**: For 2D mapping, finding optimal conditions
|
|
63
|
+
- **Spiral scans**: Efficient for circular regions, often faster than grids
|
|
64
|
+
- **Adaptive scans**: When you need to focus on regions of interest
|
|
65
|
+
- **Count scans**: For time-resolved measurements at fixed position
|
|
66
|
+
|
|
67
|
+
### Parameter Optimization
|
|
68
|
+
- Consider the trade-off between resolution (step size) and time
|
|
69
|
+
- Estimate total scan time: (num_points × dwell_time) + overhead
|
|
70
|
+
- Account for motor movement time in estimates
|
|
71
|
+
- Use coarse scans first to identify regions of interest
|
|
72
|
+
|
|
73
|
+
### Data Quality Considerations
|
|
74
|
+
- Dwell time: longer = better statistics, shorter = faster
|
|
75
|
+
- Typical ranges: 0.1s (fast survey) to 10s (high-quality data)
|
|
76
|
+
- Consider detector saturation limits
|
|
77
|
+
- Account for beam intensity variations over time
|
|
78
|
+
|
|
79
|
+
### Common Scan Patterns
|
|
80
|
+
- Energy scans: step through photon energies (XAS, RIXS)
|
|
81
|
+
- Position scans: map sample or beam position
|
|
82
|
+
- Angle scans: rocking curves, reflectivity
|
|
83
|
+
- Time scans: monitor stability or dynamics
|
|
84
|
+
|
|
85
|
+
### Best Practices
|
|
86
|
+
- Always specify: motor, start, stop, num_points, detectors
|
|
87
|
+
- Set appropriate metadata (sample name, conditions)
|
|
88
|
+
- Consider running a quick test scan first
|
|
89
|
+
- Plan for data backup and documentation
|
|
90
|
+
|
|
91
|
+
### Communication
|
|
92
|
+
- Summarize the scan configuration before starting
|
|
93
|
+
- Estimate total measurement time
|
|
94
|
+
- Suggest how to verify data quality during acquisition
|
|
95
|
+
- Recommend follow-up scans based on initial results
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
def create_tools(self) -> list[Any]:
|
|
99
|
+
"""Return tools provided by this skill."""
|
|
100
|
+
# This skill provides guidance only, no additional tools
|
|
101
|
+
return []
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"""Built-in plugin manifest for NCS core plugins.
|
|
2
|
+
|
|
3
|
+
This manifest contains plugins that are part of the NCS core distribution.
|
|
4
|
+
It is loaded directly by the application, not via entry points.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from lightfall.plugins.manifest import PluginEntry, PluginManifest
|
|
10
|
+
|
|
11
|
+
builtin_manifest = PluginManifest(
|
|
12
|
+
name="lightfall.builtin",
|
|
13
|
+
version="1.0.0",
|
|
14
|
+
description="Built-in NCS plugins",
|
|
15
|
+
plugins=[
|
|
16
|
+
# Theme plugins - preload before appearance settings
|
|
17
|
+
PluginEntry(
|
|
18
|
+
type_name="theme",
|
|
19
|
+
name="light",
|
|
20
|
+
import_path="lightfall.ui.theme.builtin:LightThemePlugin",
|
|
21
|
+
preload=True,
|
|
22
|
+
),
|
|
23
|
+
PluginEntry(
|
|
24
|
+
type_name="theme",
|
|
25
|
+
name="slate",
|
|
26
|
+
import_path="lightfall.ui.theme.builtin:SlateThemePlugin",
|
|
27
|
+
preload=True,
|
|
28
|
+
),
|
|
29
|
+
PluginEntry(
|
|
30
|
+
type_name="theme",
|
|
31
|
+
name="darkblue",
|
|
32
|
+
import_path="lightfall.ui.theme.builtin:DarkBlueThemePlugin",
|
|
33
|
+
preload=True,
|
|
34
|
+
),
|
|
35
|
+
PluginEntry(
|
|
36
|
+
type_name="theme",
|
|
37
|
+
name="islands",
|
|
38
|
+
import_path="lightfall.ui.theme.builtin:IslandsThemePlugin",
|
|
39
|
+
preload=True,
|
|
40
|
+
),
|
|
41
|
+
PluginEntry(
|
|
42
|
+
type_name="theme",
|
|
43
|
+
name="catppuccin_mocha",
|
|
44
|
+
import_path="lightfall.ui.theme.builtin:CatppuccinMochaThemePlugin",
|
|
45
|
+
preload=True,
|
|
46
|
+
),
|
|
47
|
+
PluginEntry(
|
|
48
|
+
type_name="theme",
|
|
49
|
+
name="eldritch",
|
|
50
|
+
import_path="lightfall.ui.theme.builtin:EldritchThemePlugin",
|
|
51
|
+
preload=True,
|
|
52
|
+
),
|
|
53
|
+
PluginEntry(
|
|
54
|
+
type_name="theme",
|
|
55
|
+
name="evangelion",
|
|
56
|
+
import_path="lightfall.ui.theme.builtin:EvangelionThemePlugin",
|
|
57
|
+
preload=True,
|
|
58
|
+
),
|
|
59
|
+
PluginEntry(
|
|
60
|
+
type_name="theme",
|
|
61
|
+
name="ayaka",
|
|
62
|
+
import_path="lightfall.ui.theme.builtin:AyakaThemePlugin",
|
|
63
|
+
preload=True,
|
|
64
|
+
),
|
|
65
|
+
# Appearance settings - preload to apply theme before window
|
|
66
|
+
PluginEntry(
|
|
67
|
+
type_name="settings",
|
|
68
|
+
name="appearance",
|
|
69
|
+
import_path="lightfall.ui.preferences.builtin:AppearanceSettingsPlugin",
|
|
70
|
+
preload=True,
|
|
71
|
+
),
|
|
72
|
+
# Network proxy settings - preload to configure WebEngine before any QWebEngineView
|
|
73
|
+
PluginEntry(
|
|
74
|
+
type_name="settings",
|
|
75
|
+
name="proxy",
|
|
76
|
+
import_path="lightfall.ui.preferences.proxy_settings:ProxySettingsPlugin",
|
|
77
|
+
preload=True,
|
|
78
|
+
),
|
|
79
|
+
# User Profile settings (avatar + identity preview)
|
|
80
|
+
PluginEntry(
|
|
81
|
+
type_name="settings",
|
|
82
|
+
name="user_profile",
|
|
83
|
+
import_path="lightfall.ui.preferences.user_profile_settings:UserProfileSettingsPlugin",
|
|
84
|
+
),
|
|
85
|
+
# Login & Session settings
|
|
86
|
+
PluginEntry(
|
|
87
|
+
type_name="settings",
|
|
88
|
+
name="login",
|
|
89
|
+
import_path="lightfall.ui.preferences.login_settings:LoginSettingsPlugin",
|
|
90
|
+
),
|
|
91
|
+
# External tools settings (for code navigation)
|
|
92
|
+
PluginEntry(
|
|
93
|
+
type_name="settings",
|
|
94
|
+
name="external_tools",
|
|
95
|
+
import_path="lightfall.ui.preferences.editor_settings:ExternalToolsSettingsPlugin",
|
|
96
|
+
),
|
|
97
|
+
# Device settings
|
|
98
|
+
PluginEntry(
|
|
99
|
+
type_name="settings",
|
|
100
|
+
name="devices",
|
|
101
|
+
import_path="lightfall.ui.preferences.device_settings:DeviceSettingsPlugin",
|
|
102
|
+
),
|
|
103
|
+
# Tiled settings
|
|
104
|
+
PluginEntry(
|
|
105
|
+
type_name="settings",
|
|
106
|
+
name="tiled",
|
|
107
|
+
import_path="lightfall.ui.preferences.tiled_settings:TiledSettingsPlugin",
|
|
108
|
+
),
|
|
109
|
+
# Logbook backend settings
|
|
110
|
+
PluginEntry(
|
|
111
|
+
type_name="settings",
|
|
112
|
+
name="logbook",
|
|
113
|
+
import_path="lightfall.ui.preferences.logbook_settings:LogbookSettingsPlugin",
|
|
114
|
+
),
|
|
115
|
+
# IPC settings
|
|
116
|
+
PluginEntry(
|
|
117
|
+
type_name="settings",
|
|
118
|
+
name="ipc",
|
|
119
|
+
import_path="lightfall.ui.preferences.ipc_settings:IPCSettingsPlugin",
|
|
120
|
+
),
|
|
121
|
+
# Claude settings
|
|
122
|
+
PluginEntry(
|
|
123
|
+
type_name="settings",
|
|
124
|
+
name="claude",
|
|
125
|
+
import_path="lightfall.ui.preferences.claude_settings:ClaudeSettingsPlugin",
|
|
126
|
+
),
|
|
127
|
+
# Claude agent plugin settings (enable/disable AgentPlugin instances)
|
|
128
|
+
PluginEntry(
|
|
129
|
+
type_name="settings",
|
|
130
|
+
name="claude_tools",
|
|
131
|
+
import_path="lightfall.ui.preferences.tool_settings:ClaudeToolsSettingsPlugin",
|
|
132
|
+
),
|
|
133
|
+
# Plugin management settings
|
|
134
|
+
PluginEntry(
|
|
135
|
+
type_name="settings",
|
|
136
|
+
name="plugins",
|
|
137
|
+
import_path="lightfall.ui.preferences.plugin_settings:PluginSettingsPlugin",
|
|
138
|
+
),
|
|
139
|
+
# Visualization settings
|
|
140
|
+
PluginEntry(
|
|
141
|
+
type_name="settings",
|
|
142
|
+
name="visualization",
|
|
143
|
+
import_path="lightfall.ui.preferences.visualization_settings:VisualizationSettingsPlugin",
|
|
144
|
+
),
|
|
145
|
+
# Engine plugins
|
|
146
|
+
PluginEntry(
|
|
147
|
+
type_name="engine",
|
|
148
|
+
name="bluesky",
|
|
149
|
+
import_path="lightfall.acquire.engine.plugins.bluesky_plugin:BlueskyEnginePlugin",
|
|
150
|
+
),
|
|
151
|
+
PluginEntry(
|
|
152
|
+
type_name="engine",
|
|
153
|
+
name="mock",
|
|
154
|
+
import_path="lightfall.acquire.engine.plugins.mock_plugin:MockEnginePlugin",
|
|
155
|
+
),
|
|
156
|
+
# Status bar plugins - loaded dynamically via observer pattern
|
|
157
|
+
# StatusBarManager subscribes to PluginLoader.plugin_loaded signal
|
|
158
|
+
PluginEntry(
|
|
159
|
+
type_name="statusbar",
|
|
160
|
+
name="user_status",
|
|
161
|
+
import_path="lightfall.ui.statusbar.plugins.user_status:UserStatusPlugin",
|
|
162
|
+
),
|
|
163
|
+
PluginEntry(
|
|
164
|
+
type_name="statusbar",
|
|
165
|
+
name="auth_status",
|
|
166
|
+
import_path="lightfall.ui.statusbar.plugins.auth_status:AuthStatusPlugin",
|
|
167
|
+
),
|
|
168
|
+
PluginEntry(
|
|
169
|
+
type_name="statusbar",
|
|
170
|
+
name="connection_status",
|
|
171
|
+
import_path="lightfall.ui.statusbar.plugins.connection_status:ConnectionStatusPlugin",
|
|
172
|
+
),
|
|
173
|
+
PluginEntry(
|
|
174
|
+
type_name="statusbar",
|
|
175
|
+
name="tiled_status",
|
|
176
|
+
import_path="lightfall.ui.statusbar.plugins.tiled_status:TiledStatusPlugin",
|
|
177
|
+
),
|
|
178
|
+
PluginEntry(
|
|
179
|
+
type_name="statusbar",
|
|
180
|
+
name="als_beam_status",
|
|
181
|
+
import_path="lightfall.ui.statusbar.plugins.als_beam_status:ALSBeamStatusPlugin",
|
|
182
|
+
),
|
|
183
|
+
PluginEntry(
|
|
184
|
+
type_name="statusbar",
|
|
185
|
+
name="thread_status",
|
|
186
|
+
import_path="lightfall.ui.statusbar.plugins.thread_status:ThreadStatusPlugin",
|
|
187
|
+
),
|
|
188
|
+
# Agent plugins (skill prompts and/or MCP tool bags).
|
|
189
|
+
# Each contributes via AgentRegistry; per-plugin MCP servers are
|
|
190
|
+
# assembled at agent-construction time in lightfall/claude/agent.py.
|
|
191
|
+
PluginEntry(
|
|
192
|
+
type_name="agent",
|
|
193
|
+
name="alignment",
|
|
194
|
+
import_path="lightfall.plugins.agents.alignment:BeamlineAlignmentAgent",
|
|
195
|
+
),
|
|
196
|
+
PluginEntry(
|
|
197
|
+
type_name="agent",
|
|
198
|
+
name="plan_design",
|
|
199
|
+
import_path="lightfall.plugins.agents.plan_design:PlanDesignAgent",
|
|
200
|
+
),
|
|
201
|
+
PluginEntry(
|
|
202
|
+
type_name="agent",
|
|
203
|
+
name="scan_planning",
|
|
204
|
+
import_path="lightfall.plugins.agents.scan_planning:ScanPlanningAgent",
|
|
205
|
+
),
|
|
206
|
+
PluginEntry(
|
|
207
|
+
type_name="agent",
|
|
208
|
+
name="autonomous_experiment",
|
|
209
|
+
import_path=(
|
|
210
|
+
"lightfall.plugins.agents.autonomous_experiment:"
|
|
211
|
+
"AutonomousExperimentAgent"
|
|
212
|
+
),
|
|
213
|
+
),
|
|
214
|
+
PluginEntry(
|
|
215
|
+
type_name="agent",
|
|
216
|
+
name="panel_design",
|
|
217
|
+
import_path="lightfall.plugins.agents.panel_design:PanelDesignAgent",
|
|
218
|
+
),
|
|
219
|
+
PluginEntry(
|
|
220
|
+
type_name="agent",
|
|
221
|
+
name="panel_builder",
|
|
222
|
+
import_path="lightfall.plugins.agents.panel_builder:PanelBuilderAgent",
|
|
223
|
+
),
|
|
224
|
+
PluginEntry(
|
|
225
|
+
type_name="agent",
|
|
226
|
+
name="device_tools",
|
|
227
|
+
import_path="lightfall.plugins.agents.device_tools:DeviceToolsAgent",
|
|
228
|
+
),
|
|
229
|
+
PluginEntry(
|
|
230
|
+
type_name="agent",
|
|
231
|
+
name="plan_tools",
|
|
232
|
+
import_path="lightfall.plugins.agents.plan_tools:PlanToolsAgent",
|
|
233
|
+
),
|
|
234
|
+
PluginEntry(
|
|
235
|
+
type_name="agent",
|
|
236
|
+
name="engine_tools",
|
|
237
|
+
import_path="lightfall.plugins.agents.engine_tools:EngineToolsAgent",
|
|
238
|
+
),
|
|
239
|
+
PluginEntry(
|
|
240
|
+
type_name="agent",
|
|
241
|
+
name="ipython_tools",
|
|
242
|
+
import_path="lightfall.plugins.agents.ipython_tools:IPythonToolsAgent",
|
|
243
|
+
),
|
|
244
|
+
PluginEntry(
|
|
245
|
+
type_name="agent",
|
|
246
|
+
name="lightfall_core_tools",
|
|
247
|
+
import_path="lightfall.claude.lightfall_core_tools:LFCoreToolPlugin",
|
|
248
|
+
),
|
|
249
|
+
# Current-ESAF skill. Beamline read from tiled_beamline preference;
|
|
250
|
+
# strictly now-only (no date parameter). See plugin docstring.
|
|
251
|
+
PluginEntry(
|
|
252
|
+
type_name="agent",
|
|
253
|
+
name="current_esaf",
|
|
254
|
+
import_path="lightfall.plugins.agents.current_esaf:CurrentEsafAgent",
|
|
255
|
+
),
|
|
256
|
+
# Panel plugins - preload to register with PanelRegistry before main window
|
|
257
|
+
PluginEntry(
|
|
258
|
+
type_name="panel",
|
|
259
|
+
name="logbook",
|
|
260
|
+
import_path="lightfall.ui.panels.plugins.logbook_plugin:LogbookPanelPlugin",
|
|
261
|
+
preload=True,
|
|
262
|
+
),
|
|
263
|
+
PluginEntry(
|
|
264
|
+
type_name="panel",
|
|
265
|
+
name="logbook_entries",
|
|
266
|
+
import_path="lightfall.ui.panels.plugins.logbook_entries_plugin:LogbookEntriesPanelPlugin",
|
|
267
|
+
preload=True,
|
|
268
|
+
),
|
|
269
|
+
PluginEntry(
|
|
270
|
+
type_name="panel",
|
|
271
|
+
name="devices",
|
|
272
|
+
import_path="lightfall.ui.panels.plugins.device_plugin:DevicePanelPlugin",
|
|
273
|
+
preload=True,
|
|
274
|
+
),
|
|
275
|
+
PluginEntry(
|
|
276
|
+
type_name="panel",
|
|
277
|
+
name="bluesky",
|
|
278
|
+
import_path="lightfall.ui.panels.plugins.bluesky_plugin:BlueskyPanelPlugin",
|
|
279
|
+
preload=True,
|
|
280
|
+
),
|
|
281
|
+
PluginEntry(
|
|
282
|
+
type_name="panel",
|
|
283
|
+
name="queue",
|
|
284
|
+
import_path="lightfall.ui.panels.plugins.queue_plugin:QueuePanelPlugin",
|
|
285
|
+
preload=True,
|
|
286
|
+
),
|
|
287
|
+
PluginEntry(
|
|
288
|
+
type_name="panel",
|
|
289
|
+
name="documents",
|
|
290
|
+
import_path="lightfall.ui.panels.plugins.documents_plugin:DocumentsPanelPlugin",
|
|
291
|
+
preload=True,
|
|
292
|
+
),
|
|
293
|
+
PluginEntry(
|
|
294
|
+
type_name="panel",
|
|
295
|
+
name="claude",
|
|
296
|
+
import_path="lightfall.ui.panels.plugins.claude_plugin:ClaudePanelPlugin",
|
|
297
|
+
preload=True, # Preload for metadata; panel instantiation is deferred until clicked
|
|
298
|
+
),
|
|
299
|
+
PluginEntry(
|
|
300
|
+
type_name="panel",
|
|
301
|
+
name="threads",
|
|
302
|
+
import_path="lightfall.ui.panels.plugins.threads_plugin:ThreadsPanelPlugin",
|
|
303
|
+
preload=True,
|
|
304
|
+
),
|
|
305
|
+
PluginEntry(
|
|
306
|
+
type_name="panel",
|
|
307
|
+
name="logging",
|
|
308
|
+
import_path="lightfall.ui.panels.plugins.logging_plugin:LoggingPanelPlugin",
|
|
309
|
+
preload=True,
|
|
310
|
+
),
|
|
311
|
+
PluginEntry(
|
|
312
|
+
type_name="panel",
|
|
313
|
+
name="tiled_browser",
|
|
314
|
+
import_path="lightfall.ui.panels.plugins.tiled_browser_plugin:TiledBrowserPanelPlugin",
|
|
315
|
+
preload=True,
|
|
316
|
+
),
|
|
317
|
+
PluginEntry(
|
|
318
|
+
type_name="panel",
|
|
319
|
+
name="ipython",
|
|
320
|
+
import_path="lightfall.ui.panels.plugins.ipython_plugin:IPythonPanelPlugin",
|
|
321
|
+
preload=True,
|
|
322
|
+
),
|
|
323
|
+
PluginEntry(
|
|
324
|
+
type_name="panel",
|
|
325
|
+
name="synoptic",
|
|
326
|
+
import_path="lightfall.ui.panels.plugins.synoptic_plugin:SynopticPanelPlugin",
|
|
327
|
+
preload=True,
|
|
328
|
+
),
|
|
329
|
+
PluginEntry(
|
|
330
|
+
type_name="panel",
|
|
331
|
+
name="visualization",
|
|
332
|
+
import_path="lightfall.ui.panels.plugins.visualization_plugin:VisualizationPanelPlugin",
|
|
333
|
+
preload=True,
|
|
334
|
+
),
|
|
335
|
+
PluginEntry(
|
|
336
|
+
type_name="panel",
|
|
337
|
+
name="pipeline_jobs",
|
|
338
|
+
import_path="lightfall.ui.panels.plugins.pipeline_jobs_plugin:PipelineJobsPanelPlugin",
|
|
339
|
+
preload=True,
|
|
340
|
+
),
|
|
341
|
+
PluginEntry(
|
|
342
|
+
type_name="panel",
|
|
343
|
+
name="pipeline_triggers",
|
|
344
|
+
import_path="lightfall.ui.panels.plugins.pipeline_triggers_plugin:PipelineTriggersPanelPlugin",
|
|
345
|
+
preload=True,
|
|
346
|
+
),
|
|
347
|
+
],
|
|
348
|
+
)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""Controller plugin type for device control widgets.
|
|
2
|
+
|
|
3
|
+
ControllerPlugin enables plugins to provide device- or pattern-specific
|
|
4
|
+
UI widgets for controlling devices. Controllers inspect devices and return
|
|
5
|
+
a priority (or None if not applicable), enabling dynamic, device-aware
|
|
6
|
+
widget selection.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from abc import abstractmethod
|
|
12
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
13
|
+
|
|
14
|
+
from PySide6.QtWidgets import QWidget
|
|
15
|
+
|
|
16
|
+
from lightfall.plugins.types import PluginType
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from lightfall.ui.models.device_tree import DeviceTreeItem
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ControllerPlugin(PluginType):
|
|
23
|
+
"""Abstract base for device controller plugins.
|
|
24
|
+
|
|
25
|
+
Controller plugins provide custom device control widgets that can be
|
|
26
|
+
discovered and selected automatically. Each plugin inspects device
|
|
27
|
+
items and returns a priority to indicate how well it can control them.
|
|
28
|
+
|
|
29
|
+
The `can_control()` method returns an integer priority or None:
|
|
30
|
+
- None: This plugin cannot control the given items
|
|
31
|
+
- int: Priority value (higher = preferred)
|
|
32
|
+
|
|
33
|
+
Suggested priority ranges:
|
|
34
|
+
- 200+: Exact device/prefix match
|
|
35
|
+
- 100-199: Device class match
|
|
36
|
+
- 50-99: Category match
|
|
37
|
+
- 1-49: Generic fallback
|
|
38
|
+
|
|
39
|
+
Class Attributes:
|
|
40
|
+
type_name: "controller" - identifies this as a controller plugin.
|
|
41
|
+
is_singleton: True - plugin instance is singleton, creates widgets on demand.
|
|
42
|
+
|
|
43
|
+
Example implementation::
|
|
44
|
+
|
|
45
|
+
class XYZMotorControllerPlugin(ControllerPlugin):
|
|
46
|
+
@property
|
|
47
|
+
def name(self) -> str:
|
|
48
|
+
return "xyz_motor"
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def display_name(self) -> str:
|
|
52
|
+
return "XYZ Motor Control"
|
|
53
|
+
|
|
54
|
+
def can_control(self, items: list[DeviceTreeItem]) -> int | None:
|
|
55
|
+
if len(items) != 1:
|
|
56
|
+
return None
|
|
57
|
+
item = items[0]
|
|
58
|
+
if (item.device_info and
|
|
59
|
+
item.device_info.category == DeviceCategory.MOTOR and
|
|
60
|
+
item.device_info.prefix.startswith("XYZ:")):
|
|
61
|
+
return 150 # Higher than default MotorControlWidget
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
def create_widget(self, parent=None) -> QWidget:
|
|
65
|
+
return XYZMotorWidget(parent)
|
|
66
|
+
|
|
67
|
+
The plugin can then be registered via a manifest::
|
|
68
|
+
|
|
69
|
+
manifest = PluginManifest(
|
|
70
|
+
name="my-beamline-controllers",
|
|
71
|
+
plugins=[
|
|
72
|
+
PluginEntry(
|
|
73
|
+
"controller",
|
|
74
|
+
"xyz_motor",
|
|
75
|
+
"my_beamline.plugins.xyz_motor:XYZMotorControllerPlugin",
|
|
76
|
+
),
|
|
77
|
+
]
|
|
78
|
+
)
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
type_name: ClassVar[str] = "controller"
|
|
82
|
+
is_singleton: ClassVar[bool] = True
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def description(self) -> str:
|
|
86
|
+
"""Human-readable description of this controller plugin."""
|
|
87
|
+
return "Device controller plugin"
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
@abstractmethod
|
|
91
|
+
def name(self) -> str:
|
|
92
|
+
"""Controller name used for registration and lookup.
|
|
93
|
+
|
|
94
|
+
This should be unique within the controller type and is used to
|
|
95
|
+
identify the controller in the registry.
|
|
96
|
+
"""
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def display_name(self) -> str:
|
|
101
|
+
"""Human-readable name shown in widget selector.
|
|
102
|
+
|
|
103
|
+
Override this to provide a custom display name. By default,
|
|
104
|
+
converts the name to title case (e.g., "xyz_motor" -> "Xyz Motor").
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Display name for UI.
|
|
108
|
+
"""
|
|
109
|
+
return self.name.replace("_", " ").title()
|
|
110
|
+
|
|
111
|
+
@abstractmethod
|
|
112
|
+
def can_control(self, items: list[DeviceTreeItem]) -> int | None:
|
|
113
|
+
"""Check if this controller can handle the given items and return priority.
|
|
114
|
+
|
|
115
|
+
This method is called by the ControllerMatcher to determine which
|
|
116
|
+
controllers are applicable for the current selection and their
|
|
117
|
+
relative priority.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
items: List of selected DeviceTreeItems.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Priority value (higher = preferred) or None if not applicable.
|
|
124
|
+
|
|
125
|
+
Suggested priority ranges:
|
|
126
|
+
- 200+: Exact device/prefix match
|
|
127
|
+
- 100-199: Device class match
|
|
128
|
+
- 50-99: Category match
|
|
129
|
+
- 1-49: Generic fallback
|
|
130
|
+
"""
|
|
131
|
+
...
|
|
132
|
+
|
|
133
|
+
@abstractmethod
|
|
134
|
+
def create_widget(self, parent: QWidget | None = None) -> QWidget:
|
|
135
|
+
"""Create a new widget instance for controlling devices.
|
|
136
|
+
|
|
137
|
+
This is called when the user selects this controller for their
|
|
138
|
+
device selection. The returned widget should support being
|
|
139
|
+
configured with devices via a `set_items()` method (like
|
|
140
|
+
BaseControlWidget).
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
parent: Parent widget.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
A new widget instance for controlling devices.
|
|
147
|
+
"""
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
def get_introspection_data(self) -> dict[str, Any]:
|
|
151
|
+
"""Get introspection data for MCP tools.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Dictionary with controller information.
|
|
155
|
+
"""
|
|
156
|
+
return {
|
|
157
|
+
"type": self.type_name,
|
|
158
|
+
"name": self.name,
|
|
159
|
+
"display_name": self.display_name,
|
|
160
|
+
"class": self.__class__.__name__,
|
|
161
|
+
"module": self.__class__.__module__,
|
|
162
|
+
}
|