Module: Legate
- Defined in:
- lib/legate.rb,
lib/legate.rb,
lib/legate.rb,
lib/legate/cli.rb,
lib/legate/llm.rb,
lib/legate/mcp.rb,
lib/legate/auth.rb,
lib/legate/tool.rb,
lib/legate/agent.rb,
lib/legate/event.rb,
lib/legate/agents.rb,
lib/legate/errors.rb,
lib/legate/planner.rb,
lib/legate/session.rb,
lib/legate/version.rb,
lib/legate/web/app.rb,
lib/legate/redaction.rb,
lib/legate/auth/error.rb,
lib/legate/generators.rb,
lib/legate/llm/gemini.rb,
lib/legate/llm/ollama.rb,
lib/legate/mcp/client.rb,
lib/legate/tools/echo.rb,
lib/legate/auth/config.rb,
lib/legate/auth/runner.rb,
lib/legate/auth/scheme.rb,
lib/legate/llm/adapter.rb,
lib/legate/tool_loader.rb,
lib/legate/tool_result.rb,
lib/legate/activity_log.rb,
lib/legate/agentic/loop.rb,
lib/legate/auth/manager.rb,
lib/legate/auth/schemes.rb,
lib/legate/tool_context.rb,
lib/legate/configuration.rb,
lib/legate/plan_executor.rb,
lib/legate/rails/railtie.rb,
lib/legate/tool_registry.rb,
lib/legate/auth/url_guard.rb,
lib/legate/auth/credential.rb,
lib/legate/auth/encryption.rb,
lib/legate/tools/cat_facts.rb,
lib/legate/agent_definition.rb,
lib/legate/agentic/decision.rb,
lib/legate/auth/coordinator.rb,
lib/legate/auth/token_store.rb,
lib/legate/cli/base_command.rb,
lib/legate/cli/web_commands.rb,
lib/legate/definition_store.rb,
lib/legate/mcp/tool_wrapper.rb,
lib/legate/tools/agent_tool.rb,
lib/legate/tools/calculator.rb,
lib/legate/agents/loop_agent.rb,
lib/legate/cli/auth_commands.rb,
lib/legate/cli/output_helper.rb,
lib/legate/cli/tool_commands.rb,
lib/legate/tool/metadata_dsl.rb,
lib/legate/tools/sleepy_tool.rb,
lib/legate/web/sass_compiler.rb,
lib/legate/auth/manager_store.rb,
lib/legate/auth/token_manager.rb,
lib/legate/cli/agent_commands.rb,
lib/legate/mcp/connection/sse.rb,
lib/legate/tools/webhook_tool.rb,
lib/legate/auth/schemes/oauth2.rb,
lib/legate/global_tool_manager.rb,
lib/legate/tool_code_generator.rb,
lib/legate/tools/base/safe_url.rb,
lib/legate/agent_code_generator.rb,
lib/legate/auth/schemes/api_key.rb,
lib/legate/cli/session_commands.rb,
lib/legate/mcp/connection/stdio.rb,
lib/legate/session_service/base.rb,
lib/legate/web/webhook_listener.rb,
lib/legate/agents/parallel_agent.rb,
lib/legate/auth/excon_middleware.rb,
lib/legate/auth/tool_integration.rb,
lib/legate/cli/skaffold_commands.rb,
lib/legate/web/routes/api_routes.rb,
lib/legate/auth/http_client_utils.rb,
lib/legate/configuration/webhooks.rb,
lib/legate/mcp/connection_manager.rb,
lib/legate/tools/base/http_client.rb,
lib/legate/web/routes/core_routes.rb,
lib/legate/agents/sequential_agent.rb,
lib/legate/auth/middleware_factory.rb,
lib/legate/cli/deployment_commands.rb,
lib/legate/tools/current_time_tool.rb,
lib/legate/tools/http_request_tool.rb,
lib/legate/tools/read_webpage_tool.rb,
lib/legate/auth/schemes/http_bearer.rb,
lib/legate/tools/random_number_tool.rb,
lib/legate/auth/exchanged_credential.rb,
lib/legate/generators/code_validator.rb,
lib/legate/generators/tool_generator.rb,
lib/legate/mcp/util/schema_converter.rb,
lib/legate/session_service/in_memory.rb,
lib/legate/tools/base_async_job_tool.rb,
lib/legate/callbacks/callback_context.rb,
lib/legate/generators/agent_generator.rb,
lib/legate/global_definition_registry.rb,
lib/legate/web/routes/tools_ui_routes.rb,
lib/legate/auth/schemes/openid_connect.rb,
lib/legate/auth/tool_context_extension.rb,
lib/legate/tools/check_job_status_tool.rb,
lib/legate/auth/schemes/service_account.rb,
lib/legate/session_service/active_record.rb,
lib/legate/generators/runtime_tool_loader.rb,
lib/legate/mcp/server/legate_tool_adapter.rb,
lib/legate/mcp/server/legate_agent_adapter.rb,
lib/legate/session_service/event_broadcast.rb,
lib/legate/web/routes/agent_runtime_routes.rb,
lib/legate/web/routes/documentation_routes.rb,
lib/legate/web/routes/authentication_routes.rb,
lib/legate/web/routes/tool_generator_routes.rb,
lib/legate/web/routes/agent_generator_routes.rb,
lib/legate/auth/coordinators/oidc_coordinator.rb,
lib/legate/web/routes/agent_definition_routes.rb,
lib/legate/auth/schemes/google_service_account.rb,
lib/legate/generators/legate/install_generator.rb,
lib/legate/web/routes/agent_interaction_routes.rb,
lib/legate/auth/coordinators/oauth2_coordinator.rb,
lib/legate/mcp/server/legate_direct_agent_adapter.rb,
lib/legate/web/routes/agent_authentication_routes.rb,
lib/legate/auth/coordinators/service_account_coordinator.rb
Overview
File: lib/legate/web/routes/agent_authentication_routes.rb frozen_string_literal: true
Defined Under Namespace
Modules: AgentCodeGenerator, Agentic, Agents, Auth, CLI, Callbacks, DefinitionStore, Generators, GlobalDefinitionRegistry, GlobalToolManager, LLM, Mcp, Rails, Redaction, SessionService, ToolCodeGenerator, ToolLoader, Tools, Web Classes: ActivityLog, Agent, AgentDefinition, Configuration, ConfigurationError, Error, Event, InvalidPrefixError, PlanExecutor, Planner, SerializationError, Session, StoreError, Tool, ToolArgumentError, ToolCertificateError, ToolContext, ToolError, ToolHttpError, ToolNetworkError, ToolRegistry, ToolResult, ToolTimeoutError, WebhookConfigurationError
Constant Summary collapse
- SILENT_LOG_LEVELS =
— Logger Initialization Logic — Log levels that suppress all output
%w[NONE SILENT].freeze
- VERSION =
'0.1.0'
Class Method Summary collapse
-
.config ⇒ Object
Returns the singleton configuration instance.
-
.configure {|@configuration| ... } ⇒ Object
Configure Legate settings.
- .initialize_logger ⇒ Object
- .load_environment ⇒ Object
-
.logger ⇒ Object
— Define Logger Accessor Method EARLY —.
-
.reset_config! ⇒ Object
Reset configuration (mainly for testing).
-
.tools ⇒ Array<Hash>
Lists metadata (name, description, parameters) for every globally registered tool — a discoverable entry point over GlobalToolManager.
Class Method Details
.config ⇒ Object
Returns the singleton configuration instance.
117 118 119 |
# File 'lib/legate.rb', line 117 def self.config @config_mutex.synchronize { @configuration ||= Legate::Configuration.new } end |
.configure {|@configuration| ... } ⇒ Object
Configure Legate settings
111 112 113 114 |
# File 'lib/legate.rb', line 111 def self.configure config # Ensure the singleton exists (under the mutex) yield @configuration # Yield the instance end |
.initialize_logger ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/legate.rb', line 18 def self.initialize_logger level_str = determine_log_level_str log_target, level = configure_log_settings(level_str) logger_instance = Logger.new(log_target) logger_instance.level = level logger_instance.formatter = proc { |severity, _, _, msg| "#{severity}: #{msg}\n" } logger_instance end |
.load_environment ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/legate.rb', line 77 def self.load_environment begin require 'bundler/setup' # Compatibility shim for Bundler 4.0+ and older gems (like Puma 6.x) if defined?(Bundler) && !Bundler.const_defined?(:ORIGINAL_ENV) env = if Bundler.respond_to?(:original_env) Bundler.original_env elsif Bundler.respond_to?(:with_original_env) Bundler.with_original_env { ENV.to_h } else ENV.to_h end Bundler.const_set(:ORIGINAL_ENV, env) end rescue LoadError # Ignore if Bundler is not used or gem not found end begin # Load .env here (the application's entry point), not at library require # time. dotenv is a dev-only dependency, so guard against it being absent. require 'dotenv/load' rescue LoadError # Ignore if dotenv gem is not used or .env doesn't exist end # Accept GEMINI_API_KEY as an alias for GOOGLE_API_KEY (the variable the # gemini-ai gem reads). Users naturally reach for "Gemini API key", and the # README documents GEMINI_API_KEY — map it here so the CLI and library paths # behave like config.ru's deployment entrypoint. ENV['GOOGLE_API_KEY'] ||= ENV['GEMINI_API_KEY'] if ENV['GEMINI_API_KEY'] end |
.logger ⇒ Object
— Define Logger Accessor Method EARLY —
61 62 63 |
# File 'lib/legate.rb', line 61 def self.logger @logger end |
.reset_config! ⇒ Object
Reset configuration (mainly for testing)
140 141 142 |
# File 'lib/legate.rb', line 140 def self.reset_config! @config_mutex.synchronize { @configuration = nil } end |
.tools ⇒ Array<Hash>
Lists metadata (name, description, parameters) for every globally registered tool — a discoverable entry point over GlobalToolManager.
195 196 197 |
# File 'lib/legate.rb', line 195 def self.tools Legate::GlobalToolManager.list_all_tools end |