legate 0.1.0
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +345 -0
- data/bin/legate +13 -0
- data/examples/00_quickstart.rb +51 -0
- data/examples/01_simple_agent.rb +105 -0
- data/examples/02_multi_tool_agent.rb +140 -0
- data/examples/03_custom_tool.rb +93 -0
- data/examples/04_agent_instructions.rb +84 -0
- data/examples/05_state_and_sessions.rb +91 -0
- data/examples/06_callbacks.rb +186 -0
- data/examples/07_async_jobs.rb +112 -0
- data/examples/08_loop_agent.rb +197 -0
- data/examples/09_sequential_workflow.rb +40 -0
- data/examples/10_parallel_workflow.rb +34 -0
- data/examples/11_agent_delegation.rb +24 -0
- data/examples/12_http_client_tool.rb +156 -0
- data/examples/13_authentication.rb +220 -0
- data/examples/14_mcp_client.rb +154 -0
- data/examples/15_mcp_server.rb +79 -0
- data/examples/16_webhooks.rb +91 -0
- data/examples/README_sequential_agents.md +164 -0
- data/examples/advanced/auth/cookie_auth_tool.rb +146 -0
- data/examples/advanced/auth/custom_auth_flows_example.rb +626 -0
- data/examples/advanced/auth/excon_middleware.rb +317 -0
- data/examples/advanced/auth/excon_middleware_auth.rb +399 -0
- data/examples/advanced/auth/fiber_auth_example.rb +281 -0
- data/examples/advanced/auth/fiber_oidc_example.rb +403 -0
- data/examples/advanced/auth/httpbin_bearer_tool.rb +159 -0
- data/examples/advanced/auth/oauth2_auth.rb +419 -0
- data/examples/advanced/auth/oidc_auth.rb +514 -0
- data/examples/advanced/auth/openweather_api.rb +251 -0
- data/examples/advanced/auth/openweather_tool.rb +153 -0
- data/examples/advanced/auth/query_param_middleware_test.rb +138 -0
- data/examples/advanced/auth/service_account.rb +135 -0
- data/examples/advanced/auth/test_with_httpbin.rb +202 -0
- data/examples/advanced/auth/token_lifecycle_example.rb +428 -0
- data/examples/advanced/callback_monitoring.rb +679 -0
- data/examples/advanced/mas/fixed_delegation_example.rb +191 -0
- data/examples/advanced/mas/loop_workflow.rb +28 -0
- data/examples/advanced/mas/mock_planner.rb +77 -0
- data/examples/advanced/mas/proper_delegation_example.rb +276 -0
- data/examples/advanced/mcp/legate_mcp_server_resource_example.rb +182 -0
- data/examples/advanced/mcp/mcp_resource_server_example.rb +309 -0
- data/examples/advanced/mcp/mcp_server_async.rb +76 -0
- data/examples/advanced/mcp/mcp_server_async_tools.rb +122 -0
- data/examples/advanced/mcp/mcp_server_legate_agent.rb +95 -0
- data/examples/advanced/mcp/mcp_server_rack.rb +89 -0
- data/examples/advanced/random_calculator.rb +104 -0
- data/examples/advanced/sleep_agent.rb +153 -0
- data/examples/advanced/webhooks/webhook_e2e_runner.rb +110 -0
- data/examples/advanced/webhooks/webhook_receiver_agent.rb +58 -0
- data/examples/advanced/workflows/task_refinement_loop_agent.rb +278 -0
- data/examples/advanced/workflows/travel_planner_auto_sequential.rb +444 -0
- data/examples/advanced/workflows/travel_planner_parallel.rb +656 -0
- data/examples/advanced/workflows/travel_planner_sequential.rb +512 -0
- data/examples/tools/oauth2_example.rb +136 -0
- data/examples/tools/sleepy_tool.rb +42 -0
- data/lib/legate/activity_log.rb +71 -0
- data/lib/legate/agent.rb +959 -0
- data/lib/legate/agent_code_generator.rb +185 -0
- data/lib/legate/agent_definition.rb +812 -0
- data/lib/legate/agentic/decision.rb +49 -0
- data/lib/legate/agentic/loop.rb +134 -0
- data/lib/legate/agentic.rb +5 -0
- data/lib/legate/agents/loop_agent.rb +248 -0
- data/lib/legate/agents/parallel_agent.rb +163 -0
- data/lib/legate/agents/sequential_agent.rb +190 -0
- data/lib/legate/agents.rb +14 -0
- data/lib/legate/auth/config.rb +148 -0
- data/lib/legate/auth/coordinator.rb +218 -0
- data/lib/legate/auth/coordinators/oauth2_coordinator.rb +99 -0
- data/lib/legate/auth/coordinators/oidc_coordinator.rb +68 -0
- data/lib/legate/auth/coordinators/service_account_coordinator.rb +122 -0
- data/lib/legate/auth/credential.rb +157 -0
- data/lib/legate/auth/encryption.rb +108 -0
- data/lib/legate/auth/error.rb +94 -0
- data/lib/legate/auth/exchanged_credential.rb +180 -0
- data/lib/legate/auth/excon_middleware.rb +285 -0
- data/lib/legate/auth/http_client_utils.rb +364 -0
- data/lib/legate/auth/manager.rb +531 -0
- data/lib/legate/auth/manager_store.rb +394 -0
- data/lib/legate/auth/middleware_factory.rb +290 -0
- data/lib/legate/auth/runner.rb +279 -0
- data/lib/legate/auth/scheme.rb +125 -0
- data/lib/legate/auth/schemes/api_key.rb +212 -0
- data/lib/legate/auth/schemes/google_service_account.rb +108 -0
- data/lib/legate/auth/schemes/http_bearer.rb +98 -0
- data/lib/legate/auth/schemes/oauth2.rb +396 -0
- data/lib/legate/auth/schemes/openid_connect.rb +346 -0
- data/lib/legate/auth/schemes/service_account.rb +388 -0
- data/lib/legate/auth/schemes.rb +40 -0
- data/lib/legate/auth/token_manager.rb +362 -0
- data/lib/legate/auth/token_store.rb +86 -0
- data/lib/legate/auth/tool_context_extension.rb +97 -0
- data/lib/legate/auth/tool_integration.rb +188 -0
- data/lib/legate/auth/url_guard.rb +81 -0
- data/lib/legate/auth.rb +453 -0
- data/lib/legate/callbacks/callback_context.rb +71 -0
- data/lib/legate/cli/agent_commands.rb +950 -0
- data/lib/legate/cli/auth_commands.rb +520 -0
- data/lib/legate/cli/base_command.rb +24 -0
- data/lib/legate/cli/deployment_commands.rb +934 -0
- data/lib/legate/cli/output_helper.rb +108 -0
- data/lib/legate/cli/session_commands.rb +138 -0
- data/lib/legate/cli/skaffold_commands.rb +223 -0
- data/lib/legate/cli/tool_commands.rb +261 -0
- data/lib/legate/cli/web_commands.rb +182 -0
- data/lib/legate/cli.rb +40 -0
- data/lib/legate/configuration/webhooks.rb +113 -0
- data/lib/legate/configuration.rb +39 -0
- data/lib/legate/definition_store.rb +23 -0
- data/lib/legate/errors.rb +118 -0
- data/lib/legate/event.rb +161 -0
- data/lib/legate/gemini_ai_beta_patch.rb +39 -0
- data/lib/legate/generators/agent_generator.rb +412 -0
- data/lib/legate/generators/code_validator.rb +48 -0
- data/lib/legate/generators/legate/install_generator.rb +35 -0
- data/lib/legate/generators/legate/templates/create_legate_tables.rb.tt +36 -0
- data/lib/legate/generators/legate/templates/initializer.rb +18 -0
- data/lib/legate/generators/runtime_tool_loader.rb +76 -0
- data/lib/legate/generators/tool_generator.rb +408 -0
- data/lib/legate/generators.rb +11 -0
- data/lib/legate/global_definition_registry.rb +506 -0
- data/lib/legate/global_tool_manager.rb +135 -0
- data/lib/legate/llm/adapter.rb +69 -0
- data/lib/legate/llm/gemini.rb +172 -0
- data/lib/legate/llm/ollama.rb +80 -0
- data/lib/legate/llm.rb +34 -0
- data/lib/legate/mcp/client.rb +320 -0
- data/lib/legate/mcp/connection/sse.rb +292 -0
- data/lib/legate/mcp/connection/stdio.rb +273 -0
- data/lib/legate/mcp/connection_manager.rb +103 -0
- data/lib/legate/mcp/server/legate_agent_adapter.rb +170 -0
- data/lib/legate/mcp/server/legate_direct_agent_adapter.rb +140 -0
- data/lib/legate/mcp/server/legate_tool_adapter.rb +119 -0
- data/lib/legate/mcp/tool_wrapper.rb +138 -0
- data/lib/legate/mcp/util/schema_converter.rb +134 -0
- data/lib/legate/mcp.rb +23 -0
- data/lib/legate/plan_executor.rb +375 -0
- data/lib/legate/planner.rb +839 -0
- data/lib/legate/rails/railtie.rb +43 -0
- data/lib/legate/rails.rb +9 -0
- data/lib/legate/redaction.rb +32 -0
- data/lib/legate/session.rb +299 -0
- data/lib/legate/session_service/active_record.rb +300 -0
- data/lib/legate/session_service/base.rb +68 -0
- data/lib/legate/session_service/event_broadcast.rb +74 -0
- data/lib/legate/session_service/in_memory.rb +188 -0
- data/lib/legate/tool/metadata_dsl.rb +122 -0
- data/lib/legate/tool.rb +276 -0
- data/lib/legate/tool_code_generator.rb +103 -0
- data/lib/legate/tool_context.rb +350 -0
- data/lib/legate/tool_loader.rb +39 -0
- data/lib/legate/tool_registry.rb +73 -0
- data/lib/legate/tool_result.rb +61 -0
- data/lib/legate/tools/agent_tool.rb +187 -0
- data/lib/legate/tools/base/http_client.rb +319 -0
- data/lib/legate/tools/base/safe_url.rb +56 -0
- data/lib/legate/tools/base_async_job_tool.rb +91 -0
- data/lib/legate/tools/calculator.rb +89 -0
- data/lib/legate/tools/cat_facts.rb +81 -0
- data/lib/legate/tools/check_job_status_tool.rb +48 -0
- data/lib/legate/tools/current_time_tool.rb +64 -0
- data/lib/legate/tools/echo.rb +43 -0
- data/lib/legate/tools/http_request_tool.rb +105 -0
- data/lib/legate/tools/random_number_tool.rb +64 -0
- data/lib/legate/tools/read_webpage_tool.rb +92 -0
- data/lib/legate/tools/sleepy_tool.rb +74 -0
- data/lib/legate/tools/webhook_tool.rb +146 -0
- data/lib/legate/version.rb +5 -0
- data/lib/legate/web/app.rb +984 -0
- data/lib/legate/web/public/css/main.css +4980 -0
- data/lib/legate/web/public/images/favicon-256.png +0 -0
- data/lib/legate/web/public/images/favicon-32.png +0 -0
- data/lib/legate/web/public/images/legate-logo-dark.png +0 -0
- data/lib/legate/web/public/images/legate-logo-light.png +0 -0
- data/lib/legate/web/public/js/legate.js +616 -0
- data/lib/legate/web/public/styles/main.scss +4402 -0
- data/lib/legate/web/routes/agent_authentication_routes.rb +530 -0
- data/lib/legate/web/routes/agent_definition_routes.rb +803 -0
- data/lib/legate/web/routes/agent_generator_routes.rb +80 -0
- data/lib/legate/web/routes/agent_interaction_routes.rb +734 -0
- data/lib/legate/web/routes/agent_runtime_routes.rb +323 -0
- data/lib/legate/web/routes/api_routes.rb +56 -0
- data/lib/legate/web/routes/authentication_routes.rb +1541 -0
- data/lib/legate/web/routes/core_routes.rb +111 -0
- data/lib/legate/web/routes/documentation_routes.rb +220 -0
- data/lib/legate/web/routes/tool_generator_routes.rb +81 -0
- data/lib/legate/web/routes/tools_ui_routes.rb +207 -0
- data/lib/legate/web/sass_compiler.rb +73 -0
- data/lib/legate/web/views/_active_session_info.slim +25 -0
- data/lib/legate/web/views/_activity_list.slim +55 -0
- data/lib/legate/web/views/_agent_card.slim +56 -0
- data/lib/legate/web/views/_agent_generator_modal.slim +382 -0
- data/lib/legate/web/views/_agent_status_controls.slim +71 -0
- data/lib/legate/web/views/_agent_tool_table.slim +74 -0
- data/lib/legate/web/views/_chat_message.slim +95 -0
- data/lib/legate/web/views/_display_agent_configuration.slim +26 -0
- data/lib/legate/web/views/_display_agent_description.slim +11 -0
- data/lib/legate/web/views/_display_agent_fallback.slim +15 -0
- data/lib/legate/web/views/_display_agent_hierarchy.slim +93 -0
- data/lib/legate/web/views/_display_agent_instruction.slim +17 -0
- data/lib/legate/web/views/_display_agent_mcp.slim +13 -0
- data/lib/legate/web/views/_display_agent_model.slim +17 -0
- data/lib/legate/web/views/_display_agent_name.slim +42 -0
- data/lib/legate/web/views/_display_agent_output_key.slim +26 -0
- data/lib/legate/web/views/_display_agent_type.slim +65 -0
- data/lib/legate/web/views/_edit_agent_configuration.slim +74 -0
- data/lib/legate/web/views/_edit_agent_description.slim +16 -0
- data/lib/legate/web/views/_edit_agent_fallback.slim +25 -0
- data/lib/legate/web/views/_edit_agent_hierarchy.slim +98 -0
- data/lib/legate/web/views/_edit_agent_instruction.slim +49 -0
- data/lib/legate/web/views/_edit_agent_mcp.slim +33 -0
- data/lib/legate/web/views/_edit_agent_model.slim +23 -0
- data/lib/legate/web/views/_edit_agent_output_key.slim +36 -0
- data/lib/legate/web/views/_edit_agent_tools.slim +40 -0
- data/lib/legate/web/views/_edit_agent_type.slim +67 -0
- data/lib/legate/web/views/_session_error.slim +4 -0
- data/lib/legate/web/views/_skeleton.slim +69 -0
- data/lib/legate/web/views/_tool_card.slim +9 -0
- data/lib/legate/web/views/_tool_generator_modal.slim +311 -0
- data/lib/legate/web/views/agent.slim +436 -0
- data/lib/legate/web/views/agent_auth.slim +562 -0
- data/lib/legate/web/views/agents.slim +369 -0
- data/lib/legate/web/views/auth.slim +112 -0
- data/lib/legate/web/views/auth_credential_detail.slim +327 -0
- data/lib/legate/web/views/auth_credentials.slim +261 -0
- data/lib/legate/web/views/auth_debug.slim +94 -0
- data/lib/legate/web/views/auth_mapping_detail.slim +151 -0
- data/lib/legate/web/views/auth_mapping_new.slim +123 -0
- data/lib/legate/web/views/auth_mappings.slim +120 -0
- data/lib/legate/web/views/auth_scheme_detail.slim +274 -0
- data/lib/legate/web/views/auth_schemes.slim +259 -0
- data/lib/legate/web/views/auth_test.slim +418 -0
- data/lib/legate/web/views/chat.slim +192 -0
- data/lib/legate/web/views/docs_index.slim +105 -0
- data/lib/legate/web/views/docs_show.slim +105 -0
- data/lib/legate/web/views/error_404.slim +5 -0
- data/lib/legate/web/views/index.slim +148 -0
- data/lib/legate/web/views/layout.slim +144 -0
- data/lib/legate/web/views/tool_detail.slim +87 -0
- data/lib/legate/web/views/tools.slim +50 -0
- data/lib/legate/web/webhook_listener.rb +367 -0
- data/lib/legate/web.rb +9 -0
- data/lib/legate.rb +220 -0
- data/public/docs/advanced/callbacks.md +828 -0
- data/public/docs/advanced/mcp_schema_conversion.md +59 -0
- data/public/docs/authentication/api_reference/config.md +210 -0
- data/public/docs/authentication/api_reference/credential.md +246 -0
- data/public/docs/authentication/api_reference/encryption.md +218 -0
- data/public/docs/authentication/api_reference/exchanged_credential.md +271 -0
- data/public/docs/authentication/api_reference/excon_middleware.md +175 -0
- data/public/docs/authentication/api_reference/index.md +30 -0
- data/public/docs/authentication/api_reference/scheme.md +250 -0
- data/public/docs/authentication/api_reference/schemes/api_key.md +175 -0
- data/public/docs/authentication/api_reference/schemes/google_service_account.md +221 -0
- data/public/docs/authentication/api_reference/schemes/http_bearer.md +169 -0
- data/public/docs/authentication/api_reference/schemes/oauth2.md +343 -0
- data/public/docs/authentication/api_reference/schemes/oidc.md +73 -0
- data/public/docs/authentication/api_reference/schemes/openid_connect.md +311 -0
- data/public/docs/authentication/api_reference/schemes/service_account.md +287 -0
- data/public/docs/authentication/api_reference/token_manager.md +221 -0
- data/public/docs/authentication/api_reference/token_store.md +146 -0
- data/public/docs/authentication/api_reference/tool_context_extension.md +166 -0
- data/public/docs/authentication/guides/api_key.md +190 -0
- data/public/docs/authentication/guides/bearer.md +172 -0
- data/public/docs/authentication/guides/configuration.md +255 -0
- data/public/docs/authentication/guides/custom_flow.md +523 -0
- data/public/docs/authentication/guides/index.md +24 -0
- data/public/docs/authentication/guides/migration.md +435 -0
- data/public/docs/authentication/guides/oauth2.md +252 -0
- data/public/docs/authentication/guides/oidc.md +241 -0
- data/public/docs/authentication/guides/overview.md +155 -0
- data/public/docs/authentication/guides/secure_storage.md +301 -0
- data/public/docs/authentication/guides/service_account.md +228 -0
- data/public/docs/authentication/guides/token_lifecycle.md +295 -0
- data/public/docs/authentication/guides/web_ui_integration.md +504 -0
- data/public/docs/authentication/index.md +58 -0
- data/public/docs/authentication/troubleshooting/credential_storage.md +550 -0
- data/public/docs/authentication/troubleshooting/environment_variables.md +540 -0
- data/public/docs/authentication/troubleshooting/index.md +11 -0
- data/public/docs/authentication/troubleshooting/oauth2_issues.md +220 -0
- data/public/docs/authentication/troubleshooting/oidc_issues.md +412 -0
- data/public/docs/authentication/troubleshooting/token_refresh.md +338 -0
- data/public/docs/cli/legate_cli_usage.md +363 -0
- data/public/docs/core_concepts/legate_agent_lifecycle.md +124 -0
- data/public/docs/core_concepts/legate_architecture_overview.md +110 -0
- data/public/docs/core_concepts/legate_configuration.md +116 -0
- data/public/docs/core_concepts/legate_definition_store.md +102 -0
- data/public/docs/core_concepts/legate_planner.md +94 -0
- data/public/docs/core_concepts/legate_session_service.md +104 -0
- data/public/docs/error_handling/legate_error_handling.md +122 -0
- data/public/docs/examples.md +199 -0
- data/public/docs/getting_started.md +111 -0
- data/public/docs/guides/agentic_agents.md +137 -0
- data/public/docs/guides/ai_code_generators.md +437 -0
- data/public/docs/guides/auto_loading.md +326 -0
- data/public/docs/guides/configuring_agent_webhooks.md +219 -0
- data/public/docs/guides/http_client_usage.md +264 -0
- data/public/docs/guides/llm_providers.md +137 -0
- data/public/docs/guides/mcp_client_integration.md +232 -0
- data/public/docs/guides/mcp_server_exposure.md +206 -0
- data/public/docs/guides/rails_integration.md +128 -0
- data/public/docs/guides/sending_outbound_webhooks.md +227 -0
- data/public/docs/guides/streaming.md +112 -0
- data/public/docs/guides/webhooks.md +288 -0
- data/public/docs/introduction.md +51 -0
- data/public/docs/multi_agent_systems/advanced_features.md +57 -0
- data/public/docs/multi_agent_systems/agent_delegation.md +190 -0
- data/public/docs/multi_agent_systems/agent_hierarchy.md +49 -0
- data/public/docs/multi_agent_systems/state_management.md +47 -0
- data/public/docs/multi_agent_systems/workflow_agents.md +72 -0
- data/public/docs/tools/legate_built_in_tools.md +332 -0
- data/public/docs/tools/legate_tools_and_registry.md +263 -0
- data/public/docs/web_ui/legate_web_ui.md +137 -0
- metadata +823 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_agent_tool_table.slim
|
|
2
|
+
/ Renders the tools as a card grid layout.
|
|
3
|
+
/ Expects locals:
|
|
4
|
+
/ agent_data (Hash: {name, ...}) - Used only for potential future actions
|
|
5
|
+
/ view_configured_tools (Array<Hash>: Filtered list of configured tool metadata)
|
|
6
|
+
/ mcp_tool_results (Array<Hash>: Raw results from fetch_mcp_tools for error display)
|
|
7
|
+
|
|
8
|
+
.box.mb-5
|
|
9
|
+
- if view_configured_tools && !view_configured_tools.empty?
|
|
10
|
+
.tools-card-grid
|
|
11
|
+
- view_configured_tools.each do |tool_info|
|
|
12
|
+
.tool-card
|
|
13
|
+
.tool-card-header
|
|
14
|
+
.tool-card-icon
|
|
15
|
+
- icon_class = case tool_info[:source]
|
|
16
|
+
- when :native then "fa-gem"
|
|
17
|
+
- when :mcp then "fa-plug"
|
|
18
|
+
- else "fa-wrench"
|
|
19
|
+
span.icon.is-medium
|
|
20
|
+
i.fas class=icon_class
|
|
21
|
+
.tool-card-meta
|
|
22
|
+
- source_tag_class = (tool_info[:source] == :native) ? 'is-info' : 'is-link'
|
|
23
|
+
span.tag.is-small class="#{source_tag_class} is-light" = tool_info[:source_detail]
|
|
24
|
+
|
|
25
|
+
.tool-card-body
|
|
26
|
+
h4.tool-card-title
|
|
27
|
+
- if tool_info[:source] == :native
|
|
28
|
+
a href="/tools/#{tool_info[:name]}" = tool_info[:name]
|
|
29
|
+
- else
|
|
30
|
+
= tool_info[:name]
|
|
31
|
+
p.tool-card-description= tool_info[:description] || "No description available"
|
|
32
|
+
|
|
33
|
+
.tool-card-footer
|
|
34
|
+
- if tool_info[:parameters].is_a?(Array) && !tool_info[:parameters].empty? && tool_info[:parameters].all? { |p| p.is_a?(Hash) }
|
|
35
|
+
.tool-card-params
|
|
36
|
+
span.icon.is-small
|
|
37
|
+
i.fas.fa-sliders-h
|
|
38
|
+
span.tool-param-count = "#{tool_info[:parameters].size} parameter#{'s' if tool_info[:parameters].size != 1}"
|
|
39
|
+
.tool-param-details
|
|
40
|
+
- tool_info[:parameters].each do |param|
|
|
41
|
+
.tool-param
|
|
42
|
+
code= param[:name]
|
|
43
|
+
span.tool-param-type= param[:type]
|
|
44
|
+
- if param[:required]
|
|
45
|
+
span.tag.is-danger.is-light.is-small required
|
|
46
|
+
- else
|
|
47
|
+
.tool-card-params
|
|
48
|
+
span.icon.is-small.has-text-grey-light
|
|
49
|
+
i.fas.fa-sliders-h
|
|
50
|
+
span.has-text-grey No parameters
|
|
51
|
+
|
|
52
|
+
- else
|
|
53
|
+
.tools-empty-state
|
|
54
|
+
.tools-empty-icon
|
|
55
|
+
span.icon.is-large.has-text-grey-light
|
|
56
|
+
i.fas.fa-3x.fa-toolbox
|
|
57
|
+
h4.tools-empty-title No Tools Configured
|
|
58
|
+
p.tools-empty-text This agent doesn't have any tools configured yet.
|
|
59
|
+
p.tools-empty-hint
|
|
60
|
+
| Tools give agents the ability to perform actions like searching the web,
|
|
61
|
+
| reading files, or calling external APIs.
|
|
62
|
+
|
|
63
|
+
/ --- Display MCP Server Errors (if any) ---
|
|
64
|
+
- if defined?(mcp_tool_results) && mcp_tool_results.any? { |r| r[:status] == :error }
|
|
65
|
+
.tools-mcp-errors.mt-5
|
|
66
|
+
h5.tools-mcp-errors-title
|
|
67
|
+
span.icon.is-small.mr-2
|
|
68
|
+
i.fas.fa-exclamation-triangle
|
|
69
|
+
| MCP Server Issues
|
|
70
|
+
- mcp_tool_results.each do |result|
|
|
71
|
+
- if result[:status] == :error
|
|
72
|
+
.notification.is-danger.is-light.is-size-7.mb-2
|
|
73
|
+
strong= result[:server]
|
|
74
|
+
| — #{result[:message]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_chat_message.slim
|
|
2
|
+
|
|
3
|
+
/ Display the user's message
|
|
4
|
+
.message.is-link.is-small.mb-2.user-message
|
|
5
|
+
.message-header
|
|
6
|
+
p You
|
|
7
|
+
.message-body
|
|
8
|
+
= user_message
|
|
9
|
+
|
|
10
|
+
/ Process the agent's result to get display data
|
|
11
|
+
- response_data = process_agent_response(agent_result)
|
|
12
|
+
/ Capture the original user message text for use in the Mermaid diagram generation
|
|
13
|
+
- original_user_input_for_diagram = user_message
|
|
14
|
+
|
|
15
|
+
/ Display the agent's response message
|
|
16
|
+
.message class="#{response_data[:msg_class]} agent-message is-small mb-4" id="event-#{response_data[:event_id]}"
|
|
17
|
+
.message-header
|
|
18
|
+
/ Determine and display the source of the agent's message (Agent, Tool Request, Tool Result)
|
|
19
|
+
- if agent_result.is_a?(Legate::Event) && agent_result.role == :tool_request
|
|
20
|
+
p Tool Request
|
|
21
|
+
span.tag.is-info.ml-2 #{agent_result.content[:tool_name] if agent_result.content.is_a?(Hash) && agent_result.content[:tool_name]}
|
|
22
|
+
- elsif agent_result.is_a?(Legate::Event) && agent_result.role == :tool_result
|
|
23
|
+
p Tool Result
|
|
24
|
+
- result_status = agent_result.content.is_a?(Hash) && agent_result.content[:status] ? agent_result.content[:status] : :success
|
|
25
|
+
span.tag class="is-#{result_status == :error ? 'danger' : (result_status == :pending ? 'warning' : 'success')} ml-2" #{result_status}
|
|
26
|
+
- else
|
|
27
|
+
p Agent (#{agent_name})
|
|
28
|
+
|
|
29
|
+
/ Button to toggle raw JSON display
|
|
30
|
+
- unless response_data[:raw_json_content].empty?
|
|
31
|
+
button.button.is-light.is-small.ml-1( onclick="var el = document.getElementById('raw-#{response_data[:event_id]}'); el.style.display = (el.style.display == 'none' ? 'block' : 'none');" )
|
|
32
|
+
| Raw JSON
|
|
33
|
+
|
|
34
|
+
/! --- MODIFIED: Mermaid Modal Trigger Button ---
|
|
35
|
+
- if agent_result.is_a?(Legate::Event) && agent_result.role == :agent && agent_result.content.is_a?(Hash) && agent_result.content[:plan_details]
|
|
36
|
+
- mermaid_definition = generate_mermaid_sequence_diagram(agent_result.content, original_user_input_for_diagram)
|
|
37
|
+
- unless mermaid_definition.empty?
|
|
38
|
+
button.button.is-light.is-small.ml-1.show-mermaid-flow-btn(data-mermaid-definition=mermaid_definition)
|
|
39
|
+
span.icon.is-small
|
|
40
|
+
i.fas.fa-project-diagram
|
|
41
|
+
span Flow
|
|
42
|
+
/! --- END MODIFICATION ---
|
|
43
|
+
|
|
44
|
+
.message-body
|
|
45
|
+
/ Display the primary textual content of the agent's response
|
|
46
|
+
- if agent_result.is_a?(Legate::Event) && agent_result.role == :tool_request
|
|
47
|
+
- if agent_result.content.is_a?(Hash)
|
|
48
|
+
- if agent_result.content[:params].is_a?(Hash) && !agent_result.content[:params].empty?
|
|
49
|
+
p.mb-2 Parameters:
|
|
50
|
+
pre.has-background-light.p-2.is-size-7= JSON.pretty_generate(agent_result.content[:params])
|
|
51
|
+
- else
|
|
52
|
+
p No parameters
|
|
53
|
+
- else
|
|
54
|
+
p= agent_result.content.to_s
|
|
55
|
+
- elsif agent_result.is_a?(Legate::Event) && agent_result.role == :tool_result
|
|
56
|
+
- if agent_result.content.is_a?(Hash)
|
|
57
|
+
- if agent_result.content[:error]
|
|
58
|
+
p.has-text-danger= agent_result.content[:error]
|
|
59
|
+
- elsif agent_result.content[:result]
|
|
60
|
+
- result_content = agent_result.content[:result]
|
|
61
|
+
- if result_content.is_a?(String)
|
|
62
|
+
p= result_content
|
|
63
|
+
- else
|
|
64
|
+
pre.has-background-light.p-2.is-size-7= JSON.pretty_generate(result_content)
|
|
65
|
+
- else
|
|
66
|
+
pre.has-background-light.p-2.is-size-7= JSON.pretty_generate(agent_result.content)
|
|
67
|
+
- else
|
|
68
|
+
p= agent_result.content.to_s
|
|
69
|
+
- else
|
|
70
|
+
div style="white-space: pre-wrap; word-break: break-all; margin-bottom: 0.5rem;" = response_data[:display_content]
|
|
71
|
+
|
|
72
|
+
/! Display Execution Plan details if available
|
|
73
|
+
- if agent_result.is_a?(Legate::Event) && agent_result.content.is_a?(Hash) && agent_result.content[:plan_details].is_a?(Array) && !agent_result.content[:plan_details].empty?
|
|
74
|
+
details.execution-plan-details
|
|
75
|
+
summary.execution-plan-summary
|
|
76
|
+
| Execution Plan (#{agent_result.content[:plan_details].size} step#{'s' if agent_result.content[:plan_details].size != 1})
|
|
77
|
+
.execution-plan-steps
|
|
78
|
+
- agent_result.content[:plan_details].each_with_index do |step_detail, index|
|
|
79
|
+
.execution-plan-step
|
|
80
|
+
p.step-title Step #{index + 1}: #{step_detail[:tool_name]}
|
|
81
|
+
p.step-params-label Parameters:
|
|
82
|
+
pre.step-params-pre= pretty_json(step_detail[:params] || {})
|
|
83
|
+
|
|
84
|
+
- result_status = step_detail.dig(:result, :status)
|
|
85
|
+
- result_class = case result_status when :success then 'has-text-success-dark' when :error then 'has-text-danger-dark' when :pending then 'has-text-warning-dark' else 'has-text-grey' end
|
|
86
|
+
|
|
87
|
+
p class="step-result-label #{result_class}" Result (#{result_status || "unknown"}):
|
|
88
|
+
pre class="step-result-pre #{result_class}"= pretty_json(step_detail[:result] || {}) rescue "{}"
|
|
89
|
+
|
|
90
|
+
/! Display Raw JSON content (hidden by default)
|
|
91
|
+
- unless response_data[:raw_json_content].empty?
|
|
92
|
+
div.raw-json-container id="raw-#{response_data[:event_id]}" style="display: none;"
|
|
93
|
+
pre.raw-json-pre= response_data[:raw_json_content]
|
|
94
|
+
|
|
95
|
+
/! --- REMOVED: Inline Mermaid Diagram Container and pre.mermaid ---
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_configuration.slim
|
|
2
|
+
/ Displays the read-only configuration fields for an agent.
|
|
3
|
+
/ Expects locals: agent_data
|
|
4
|
+
|
|
5
|
+
.box.config-panel
|
|
6
|
+
h3.title.is-5.mb-4 Configuration Details
|
|
7
|
+
|
|
8
|
+
/ --- Model ---
|
|
9
|
+
div.config-field
|
|
10
|
+
== slim :_display_agent_model, locals: { agent_data: agent_data, show_edit_button: true }
|
|
11
|
+
|
|
12
|
+
/ --- Fallback ---
|
|
13
|
+
div.config-field
|
|
14
|
+
== slim :_display_agent_fallback, locals: { agent_data: agent_data, show_edit_button: true }
|
|
15
|
+
|
|
16
|
+
/ --- MCP ---
|
|
17
|
+
div.config-field
|
|
18
|
+
== slim :_display_agent_mcp, locals: { agent_data: agent_data, show_edit_button: true }
|
|
19
|
+
|
|
20
|
+
/ --- Output Key ---
|
|
21
|
+
div.config-field
|
|
22
|
+
== slim :_display_agent_output_key, locals: { agent_data: agent_data, show_edit_button: true }
|
|
23
|
+
|
|
24
|
+
/ --- Instructions ---
|
|
25
|
+
div.config-field
|
|
26
|
+
== slim :_display_agent_instruction, locals: { agent_data: agent_data, show_edit_button: true }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_description.slim
|
|
2
|
+
/ Displays the agent description and an edit button
|
|
3
|
+
|
|
4
|
+
/ Use a flex container to keep text and button together
|
|
5
|
+
.is-flex.is-align-items-center
|
|
6
|
+
/ Description text paragraph
|
|
7
|
+
p.description-text.has-text-grey.mb-0= agent_data[:description] || "No description provided."
|
|
8
|
+
/ Edit button with left margin for spacing
|
|
9
|
+
button.button.is-small.is-text.has-text-grey.edit-description-btn.ml-2 hx-get="/agents/#{agent_data[:name]}/edit/description" hx-target="#agent-description-display" hx-swap="outerHTML"
|
|
10
|
+
span.icon.is-small
|
|
11
|
+
i.fas.fa-pencil-alt
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_fallback.slim
|
|
2
|
+
/ Displays the agent fallback mode and optionally an edit button.
|
|
3
|
+
/ Expects locals: agent_data, show_edit_button (boolean, optional, defaults to true)
|
|
4
|
+
|
|
5
|
+
- show_edit_button = defined?(show_edit_button) ? show_edit_button : true
|
|
6
|
+
|
|
7
|
+
div#agent-fallback-display-container
|
|
8
|
+
.config-field-row
|
|
9
|
+
.config-field-main
|
|
10
|
+
span.config-label Planning Fallback
|
|
11
|
+
- fallback_text = agent_data[:fallback_mode] == :echo ? "Echo User Input" : "Return Error Message"
|
|
12
|
+
span.config-value= fallback_text
|
|
13
|
+
- if show_edit_button
|
|
14
|
+
button.config-edit-btn(hx-get="/agents/#{agent_data[:name]}/edit/fallback" hx-target="#agent-fallback-display-container" hx-swap="outerHTML" title="Edit planning fallback")
|
|
15
|
+
i.fas.fa-pencil-alt
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_hierarchy.slim
|
|
2
|
+
/ Expects agent_data hash with name, agent_type, sub_agent_names
|
|
3
|
+
|
|
4
|
+
- agent_name = agent_data[:name]
|
|
5
|
+
- agent_type = agent_data[:agent_type]&.to_sym || :llm
|
|
6
|
+
- sub_agent_names = agent_data[:sub_agent_names] || []
|
|
7
|
+
- show_edit_button = locals.fetch(:show_edit_button, true)
|
|
8
|
+
- loop_max = agent_data[:loop_max_iterations]
|
|
9
|
+
- loop_key = agent_data[:loop_condition_state_key]
|
|
10
|
+
- loop_val = agent_data[:loop_condition_expected_value]
|
|
11
|
+
|
|
12
|
+
.content#agent-hierarchy-display
|
|
13
|
+
h4.is-size-5
|
|
14
|
+
span.icon.mr-2
|
|
15
|
+
- type_icon = case agent_type
|
|
16
|
+
- when :sequential then "fa-list-ol"
|
|
17
|
+
- when :parallel then "fa-layer-group"
|
|
18
|
+
- when :loop then "fa-sync-alt"
|
|
19
|
+
- else "fa-sitemap"
|
|
20
|
+
i(class="fas #{type_icon}")
|
|
21
|
+
|
|
22
|
+
- if agent_type == :llm
|
|
23
|
+
| Delegation Targets
|
|
24
|
+
- elsif agent_type == :sequential
|
|
25
|
+
| Sequential Workflow
|
|
26
|
+
- elsif agent_type == :parallel
|
|
27
|
+
| Parallel Workflow
|
|
28
|
+
- elsif agent_type == :loop
|
|
29
|
+
| Loop Workflow
|
|
30
|
+
- else
|
|
31
|
+
| Agent Hierarchy
|
|
32
|
+
|
|
33
|
+
- if agent_type == :llm
|
|
34
|
+
p.help This agent can delegate tasks to the following agents:
|
|
35
|
+
- elsif agent_type == :sequential
|
|
36
|
+
p.help Sub-agents execute in sequence, passing state between them.
|
|
37
|
+
- elsif agent_type == :parallel
|
|
38
|
+
p.help Sub-agents execute concurrently and results are combined.
|
|
39
|
+
- elsif agent_type == :loop
|
|
40
|
+
p.help Sub-agents execute repeatedly until a condition is met.
|
|
41
|
+
.tags.are-medium.mt-2.mb-3
|
|
42
|
+
- if loop_max
|
|
43
|
+
span.tag.is-light
|
|
44
|
+
span.has-text-weight-bold.mr-1 Max:
|
|
45
|
+
= loop_max
|
|
46
|
+
- if loop_key
|
|
47
|
+
span.tag.is-light
|
|
48
|
+
span.has-text-weight-bold.mr-1 Until:
|
|
49
|
+
code = loop_key
|
|
50
|
+
span.mx-1 ==
|
|
51
|
+
code = loop_val.inspect
|
|
52
|
+
|
|
53
|
+
- if sub_agent_names.any?
|
|
54
|
+
.panel.mt-3
|
|
55
|
+
p.panel-heading.is-size-6
|
|
56
|
+
= agent_type == :llm ? "Delegation Targets" : "Workflow Components"
|
|
57
|
+
span.tag.is-info.is-light.ml-2= "#{sub_agent_names.size} #{sub_agent_names.size == 1 ? 'agent' : 'agents'}"
|
|
58
|
+
|
|
59
|
+
- if agent_type == :sequential
|
|
60
|
+
p.panel-block.is-size-7.has-text-grey
|
|
61
|
+
| Agents will execute in the order shown below:
|
|
62
|
+
|
|
63
|
+
- sub_agent_names.each_with_index do |sub_agent_name, index|
|
|
64
|
+
a.panel-block(href="/agents/#{sub_agent_name}")
|
|
65
|
+
span.icon.is-small.mr-2
|
|
66
|
+
- if agent_type == :sequential
|
|
67
|
+
span.tag.is-info.is-light.mr-1= index + 1
|
|
68
|
+
- elsif agent_type == :parallel
|
|
69
|
+
i.fas.fa-arrow-right
|
|
70
|
+
- elsif agent_type == :loop
|
|
71
|
+
i.fas.fa-redo-alt
|
|
72
|
+
- else
|
|
73
|
+
i.fas.fa-chevron-right
|
|
74
|
+
= sub_agent_name
|
|
75
|
+
- else
|
|
76
|
+
.notification.is-light.is-warning
|
|
77
|
+
- if agent_type == :llm
|
|
78
|
+
| No delegation targets configured. This agent cannot delegate tasks.
|
|
79
|
+
- else
|
|
80
|
+
| This workflow has no components defined. Add sub-agents to make this workflow functional.
|
|
81
|
+
|
|
82
|
+
- if show_edit_button
|
|
83
|
+
.field.mt-4
|
|
84
|
+
button.button.is-small.is-link.is-light(
|
|
85
|
+
hx-get="/agents/#{agent_name}/edit/hierarchy"
|
|
86
|
+
hx-target="#agent-hierarchy-display"
|
|
87
|
+
hx-swap="outerHTML"
|
|
88
|
+
hx-indicator=".htmx-indicator")
|
|
89
|
+
span.icon.is-small.htmx-indicator
|
|
90
|
+
i.fas.fa-spinner.fa-spin
|
|
91
|
+
span.icon.is-small
|
|
92
|
+
i.fas.fa-edit
|
|
93
|
+
span Edit Configuration
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_instruction.slim
|
|
2
|
+
/ Displays the agent instructions and optionally an edit button.
|
|
3
|
+
/ Expects locals: agent_data, show_edit_button (boolean, optional, defaults to true)
|
|
4
|
+
|
|
5
|
+
- show_edit_button = defined?(show_edit_button) ? show_edit_button : true
|
|
6
|
+
|
|
7
|
+
div#agent-instruction-display-container
|
|
8
|
+
.config-field-head
|
|
9
|
+
span.config-label Instructions (System Prompt)
|
|
10
|
+
- if show_edit_button
|
|
11
|
+
button.config-edit-btn(hx-get="/agents/#{agent_data[:name]}/edit/instruction" hx-target="#agent-instruction-display-container" hx-swap="outerHTML" title="Edit instructions")
|
|
12
|
+
i.fas.fa-pencil-alt
|
|
13
|
+
- instruction_text = agent_data[:instruction]
|
|
14
|
+
- if instruction_text.nil? || instruction_text.strip.empty?
|
|
15
|
+
p.config-empty No specific instructions provided.
|
|
16
|
+
- else
|
|
17
|
+
pre.config-code.instruction-display= instruction_text
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_mcp.slim
|
|
2
|
+
/ Displays the agent MCP server configuration and optionally an edit button.
|
|
3
|
+
/ Expects locals: agent_data, show_edit_button (boolean, optional, defaults to true)
|
|
4
|
+
|
|
5
|
+
- show_edit_button = defined?(show_edit_button) ? show_edit_button : true
|
|
6
|
+
|
|
7
|
+
div#agent-mcp-display-container
|
|
8
|
+
.config-field-head
|
|
9
|
+
span.config-label MCP Server Configurations (JSON)
|
|
10
|
+
- if show_edit_button
|
|
11
|
+
button.config-edit-btn(hx-get="/agents/#{agent_data[:name]}/edit/mcp" hx-target="#agent-mcp-display-container" hx-swap="outerHTML" title="Edit MCP servers")
|
|
12
|
+
i.fas.fa-pencil-alt
|
|
13
|
+
pre.config-code.mcp-json-display= agent_data[:mcp_display_string]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_model.slim
|
|
2
|
+
/ Displays the agent model and optionally an edit button.
|
|
3
|
+
/ Expects locals: agent_data, show_edit_button (boolean, optional, defaults to true)
|
|
4
|
+
|
|
5
|
+
- show_edit_button = defined?(show_edit_button) ? show_edit_button : true
|
|
6
|
+
|
|
7
|
+
div#agent-model-display-container
|
|
8
|
+
.config-field-row
|
|
9
|
+
.config-field-main
|
|
10
|
+
span.config-label Model
|
|
11
|
+
span.mono-chip
|
|
12
|
+
span.icon.is-small
|
|
13
|
+
i.fas.fa-microchip
|
|
14
|
+
span= agent_data[:model]
|
|
15
|
+
- if show_edit_button
|
|
16
|
+
button.config-edit-btn(hx-get="/agents/#{agent_data[:name]}/edit/model" hx-target="#agent-model-display-container" hx-swap="outerHTML" title="Edit model")
|
|
17
|
+
i.fas.fa-pencil-alt
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_name.slim
|
|
2
|
+
/ Expects locals: agent_data (Hash)
|
|
3
|
+
|
|
4
|
+
- if agent_data && agent_data[:name]
|
|
5
|
+
.agent-hero-identity
|
|
6
|
+
/ Agent name - large and prominent
|
|
7
|
+
h1.agent-hero-name= agent_data[:name]
|
|
8
|
+
|
|
9
|
+
/ Badges row - model and type
|
|
10
|
+
.agent-hero-badges
|
|
11
|
+
/ Model badge
|
|
12
|
+
- if agent_data[:model]
|
|
13
|
+
span.tag.is-info.is-light.is-rounded.agent-model-badge
|
|
14
|
+
span.icon.is-small
|
|
15
|
+
i.fas.fa-microchip
|
|
16
|
+
span= agent_data[:model]
|
|
17
|
+
|
|
18
|
+
/ Type badge
|
|
19
|
+
- agent_type = agent_data[:agent_type]&.to_sym || :llm
|
|
20
|
+
- type_class = case agent_type
|
|
21
|
+
- when :sequential then "is-primary is-light"
|
|
22
|
+
- when :parallel then "is-link is-light"
|
|
23
|
+
- when :loop then "is-warning is-light"
|
|
24
|
+
- else "is-light"
|
|
25
|
+
- type_label = case agent_type
|
|
26
|
+
- when :sequential then "Sequential"
|
|
27
|
+
- when :parallel then "Parallel"
|
|
28
|
+
- when :loop then "Loop"
|
|
29
|
+
- else "LLM"
|
|
30
|
+
span.tag.is-rounded(class=type_class)
|
|
31
|
+
span.icon.is-small
|
|
32
|
+
- type_icon = case agent_type
|
|
33
|
+
- when :sequential then "fa-list-ol"
|
|
34
|
+
- when :parallel then "fa-layer-group"
|
|
35
|
+
- when :loop then "fa-sync-alt"
|
|
36
|
+
- else "fa-robot"
|
|
37
|
+
i(class="fas #{type_icon}")
|
|
38
|
+
span= type_label
|
|
39
|
+
|
|
40
|
+
- else
|
|
41
|
+
.agent-hero-identity
|
|
42
|
+
h1.agent-hero-name.has-text-danger [Error: Agent Name Unavailable]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_output_key.slim
|
|
2
|
+
/ Expects agent_data hash with output_key
|
|
3
|
+
/ locals: show_edit_button (boolean)
|
|
4
|
+
|
|
5
|
+
- output_key = agent_data[:output_key]
|
|
6
|
+
- show_edit_button = locals.fetch(:show_edit_button, false)
|
|
7
|
+
|
|
8
|
+
.field#agent-output-key-display
|
|
9
|
+
.config-field-row
|
|
10
|
+
.config-field-main
|
|
11
|
+
span.config-label Output Key
|
|
12
|
+
- if output_key && !output_key.to_s.empty?
|
|
13
|
+
span.mono-chip
|
|
14
|
+
span.icon.is-small
|
|
15
|
+
i.fas.fa-key
|
|
16
|
+
span= output_key
|
|
17
|
+
- else
|
|
18
|
+
span.config-empty No output key configured
|
|
19
|
+
- if show_edit_button
|
|
20
|
+
button.config-edit-btn(
|
|
21
|
+
hx-get="/agents/#{agent_data[:name]}/edit/output_key"
|
|
22
|
+
hx-target="#agent-output-key-display"
|
|
23
|
+
hx-swap="outerHTML"
|
|
24
|
+
title="Edit Output Key"
|
|
25
|
+
)
|
|
26
|
+
i.fas.fa-pencil-alt
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_display_agent_type.slim
|
|
2
|
+
/ Expects agent_data hash with name and agent_type
|
|
3
|
+
|
|
4
|
+
- agent_name = agent_data[:name]
|
|
5
|
+
- agent_type = agent_data[:agent_type]&.to_sym || :llm
|
|
6
|
+
- planning_strategy = agent_data[:planning_strategy]&.to_sym || :plan
|
|
7
|
+
- show_edit_button = locals.fetch(:show_edit_button, true)
|
|
8
|
+
|
|
9
|
+
.content#agent-type-display
|
|
10
|
+
h4.is-size-5
|
|
11
|
+
span.icon.mr-2
|
|
12
|
+
- type_icon = case agent_type
|
|
13
|
+
- when :sequential then "fa-list-ol"
|
|
14
|
+
- when :parallel then "fa-layer-group"
|
|
15
|
+
- when :loop then "fa-sync-alt"
|
|
16
|
+
- else "fa-robot"
|
|
17
|
+
i(class="fas #{type_icon}")
|
|
18
|
+
| Agent Type
|
|
19
|
+
|
|
20
|
+
.tags.has-addons.mb-2
|
|
21
|
+
- type_class = case agent_type
|
|
22
|
+
- when :sequential then "is-primary"
|
|
23
|
+
- when :parallel then "is-info"
|
|
24
|
+
- when :loop then "is-warning"
|
|
25
|
+
- else "is-light"
|
|
26
|
+
span.tag.is-medium(class=type_class)
|
|
27
|
+
- type_label = case agent_type
|
|
28
|
+
- when :sequential then "Sequential Workflow"
|
|
29
|
+
- when :parallel then "Parallel Workflow"
|
|
30
|
+
- when :loop then "Loop Workflow"
|
|
31
|
+
- else "LLM Agent"
|
|
32
|
+
= type_label
|
|
33
|
+
|
|
34
|
+
- if agent_type == :llm
|
|
35
|
+
.tags.has-addons.mb-2
|
|
36
|
+
span.tag.is-medium.is-dark Planning
|
|
37
|
+
span.tag.is-medium(class=(planning_strategy == :react ? "is-success" : "is-light"))
|
|
38
|
+
= planning_strategy == :react ? "ReAct (agentic loop)" : "Plan (default)"
|
|
39
|
+
p.help
|
|
40
|
+
| Standard LLM agent. Can have sub-agents and be used for delegation.
|
|
41
|
+
- if planning_strategy == :react
|
|
42
|
+
br
|
|
43
|
+
| ReAct: acts one step at a time, observing each tool result before deciding the next.
|
|
44
|
+
- elsif agent_type == :sequential
|
|
45
|
+
p.help
|
|
46
|
+
| Sequential workflow agent. Executes sub-agents in sequence, passing state between them.
|
|
47
|
+
- elsif agent_type == :parallel
|
|
48
|
+
p.help
|
|
49
|
+
| Parallel workflow agent. Executes sub-agents concurrently and combines their results.
|
|
50
|
+
- elsif agent_type == :loop
|
|
51
|
+
p.help
|
|
52
|
+
| Loop workflow agent. Repeatedly executes sub-agents until a condition is met.
|
|
53
|
+
|
|
54
|
+
- if show_edit_button
|
|
55
|
+
.field.mt-3
|
|
56
|
+
button.button.is-small.is-link.is-light(
|
|
57
|
+
hx-get="/agents/#{agent_name}/edit/type"
|
|
58
|
+
hx-target="#agent-type-display"
|
|
59
|
+
hx-swap="outerHTML"
|
|
60
|
+
hx-indicator="this .htmx-indicator")
|
|
61
|
+
span.icon.is-small.htmx-indicator
|
|
62
|
+
i.fas.fa-spinner.fa-spin
|
|
63
|
+
span.icon.is-small
|
|
64
|
+
i.fas.fa-edit
|
|
65
|
+
span Edit Type
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_edit_agent_configuration.slim
|
|
2
|
+
/ Displays the form for editing agent configuration fields.
|
|
3
|
+
/ Expects locals: agent_data, available_models, error_message (optional)
|
|
4
|
+
|
|
5
|
+
.box
|
|
6
|
+
form( hx-put="/agents/#{agent_data[:name]}/update/configuration"
|
|
7
|
+
hx-target="#agent-configuration-content"
|
|
8
|
+
hx-swap="innerHTML" )
|
|
9
|
+
|
|
10
|
+
h3.title.is-5 Edit Agent Configuration
|
|
11
|
+
|
|
12
|
+
/ --- Display Error Message if Present ---
|
|
13
|
+
- if defined?(error_message) && error_message
|
|
14
|
+
.notification.is-danger.is-light.mb-4
|
|
15
|
+
button.delete type="button" onclick="this.parentElement.remove()"
|
|
16
|
+
= error_message
|
|
17
|
+
|
|
18
|
+
/ --- Model ---
|
|
19
|
+
.field.mb-4
|
|
20
|
+
label.label Language Model
|
|
21
|
+
/! Use edit partial content directly
|
|
22
|
+
.field.has-addons
|
|
23
|
+
.control.is-expanded
|
|
24
|
+
.select.is-fullwidth
|
|
25
|
+
select(name="model")
|
|
26
|
+
- current_model = agent_data[:model] || Legate::Agent::DEFAULT_MODEL
|
|
27
|
+
- available_models.each do |model_name|
|
|
28
|
+
option(value=model_name selected=(model_name == current_model)) = model_name
|
|
29
|
+
/! Buttons moved to bottom
|
|
30
|
+
|
|
31
|
+
/ --- Fallback ---
|
|
32
|
+
.field.mb-4
|
|
33
|
+
label.label Planning Fallback
|
|
34
|
+
/! Use edit partial content directly
|
|
35
|
+
.field.has-addons
|
|
36
|
+
.control.is-expanded
|
|
37
|
+
.select.is-fullwidth
|
|
38
|
+
select(name="fallback_mode")
|
|
39
|
+
- current_fallback_mode = agent_data[:fallback_mode] || 'error'
|
|
40
|
+
option(value="error" selected=(current_fallback_mode == 'error')) Return Error Message
|
|
41
|
+
option(value="echo" selected=(current_fallback_mode == 'echo')) Attempt Echo Tool (if available)
|
|
42
|
+
/! Buttons moved to bottom
|
|
43
|
+
|
|
44
|
+
/ --- MCP ---
|
|
45
|
+
.field.mb-4
|
|
46
|
+
label.label for="mcp-json-editor" MCP Server Configurations (JSON Array)
|
|
47
|
+
/! Use edit partial content directly
|
|
48
|
+
.control
|
|
49
|
+
textarea.textarea#mcp-json-editor name="mcp_servers_json" rows="6" placeholder='[{"type": "stdio", "command": "...", "args": ["..."]}]' == agent_data[:mcp_servers_json]
|
|
50
|
+
p.help
|
|
51
|
+
| Enter a valid JSON array or leave empty. Example: `[{"type": "stdio", "command": "npx", "args": [...]}]`
|
|
52
|
+
|
|
53
|
+
/ --- Instructions ---
|
|
54
|
+
.field.mb-5
|
|
55
|
+
label.label for="edit-instruction-textarea" Instructions (System Prompt)
|
|
56
|
+
/! Use edit partial content directly
|
|
57
|
+
.control
|
|
58
|
+
textarea.textarea#edit-instruction-textarea name="instruction" rows="5" placeholder="Guide the agent's behavior..." == agent_data[:instruction]
|
|
59
|
+
p.help Guide behavior, persona, tool usage. Markdown might be supported by the model.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/ --- Action Buttons ---
|
|
63
|
+
.field.is-grouped.is-grouped-right
|
|
64
|
+
.control
|
|
65
|
+
button.button.is-light( type="button"
|
|
66
|
+
hx-get="/agents/#{agent_data[:name]}/display/configuration"
|
|
67
|
+
hx-target="#agent-configuration-content"
|
|
68
|
+
hx-swap="innerHTML" )
|
|
69
|
+
span Cancel
|
|
70
|
+
.control
|
|
71
|
+
button.button.is-success(type="submit")
|
|
72
|
+
span.icon.is-small
|
|
73
|
+
i.fas.fa-check
|
|
74
|
+
span Save Configuration
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_edit_agent_description.slim
|
|
2
|
+
div#agent-description-display
|
|
3
|
+
form( hx-put="/agents/#{agent_data[:name]}/update/description" hx-target="#agent-description-display" hx-swap="outerHTML" )
|
|
4
|
+
.field
|
|
5
|
+
label.label.is-small Description
|
|
6
|
+
.control
|
|
7
|
+
textarea.textarea.is-small(name="value" rows="3" style="min-height: 6em;")= agent_data[:description]
|
|
8
|
+
.field.is-grouped.is-grouped-right
|
|
9
|
+
.control
|
|
10
|
+
button.button.is-light.is-small(type="button" hx-get="/agents/#{agent_data[:name]}/display/description" hx-target="#agent-description-display" hx-swap="outerHTML")
|
|
11
|
+
span Cancel
|
|
12
|
+
.control
|
|
13
|
+
button.button.is-success.is-small(type="submit")
|
|
14
|
+
span.icon.is-small
|
|
15
|
+
i.fas.fa-check
|
|
16
|
+
span Save
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/ File: lib/legate/web/views/_edit_agent_fallback.slim
|
|
2
|
+
/ Expects: agent_data (Hash: {name, fallback_mode})
|
|
3
|
+
|
|
4
|
+
- current_fallback_mode = agent_data[:fallback_mode] || 'error'
|
|
5
|
+
form( hx-put="/agents/#{agent_data[:name]}/update/fallback"
|
|
6
|
+
hx-target="this"
|
|
7
|
+
hx-swap="outerHTML" )
|
|
8
|
+
label.label Planning Fallback
|
|
9
|
+
.field.has-addons
|
|
10
|
+
.control.is-expanded
|
|
11
|
+
.select.is-fullwidth
|
|
12
|
+
select(name="value")
|
|
13
|
+
option(value="error" selected=(current_fallback_mode == 'error')) Return Error Message
|
|
14
|
+
option(value="echo" selected=(current_fallback_mode == 'echo')) Attempt Echo Tool (if available)
|
|
15
|
+
.control
|
|
16
|
+
button.button( type="button"
|
|
17
|
+
hx-get="/agents/#{agent_data[:name]}/display/fallback"
|
|
18
|
+
hx-target="closest form"
|
|
19
|
+
hx-swap="outerHTML" )
|
|
20
|
+
span Cancel
|
|
21
|
+
.control
|
|
22
|
+
button.button.is-success(type="submit")
|
|
23
|
+
span.icon.is-small
|
|
24
|
+
i.fas.fa-check
|
|
25
|
+
span Save
|