Class: Legate::Web::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Legate::Web::App
- Defined in:
- lib/legate/web/app.rb
Overview
Sinatra application providing a web UI for managing and interacting with Legate Agents. Uses GlobalDefinitionRegistry for agent definitions and an in-memory hash for running agent instances. Leverages HTMX for dynamic UI updates and communicates with external tools via MCP.
Constant Summary collapse
- CSRF_SAFE_METHODS =
%w[GET HEAD OPTIONS].freeze
- AVAILABLE_MODELS =
— Constants — List of available Gemini models selectable in the UI. Now includes beta models since we’re using v1beta API endpoint
[ 'gemini-3.5-flash', 'gemini-2.5-flash', 'gemini-2.5-pro', # Preview / Experimental 'gemini-3-pro-preview' ].freeze
Instance Method Summary collapse
-
#initialize ⇒ App
constructor
— Instance Variables — Initializes application state, including connections and services.
Constructor Details
#initialize ⇒ App
— Instance Variables — Initializes application state, including connections and services.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/legate/web/app.rb', line 157 def initialize super @logger = Legate.logger # Ensure logger is set early # In-memory map of active/running Legate::Agent instances. Keyed by the # agent's STRING name (the `/agents/:name/...` route-param form). Note that # definition hashes store `:name` as a Symbol, so any running-state lookup # that starts from a definition must `.to_s` the name before `@agents.key?`. @agents = Concurrent::Map.new # Service responsible for managing chat sessions (stores conversation history). # Uses the global Legate.config.session_service for consistency with CLI. @session_service = Legate.config.session_service # Use GlobalDefinitionRegistry as the definition store (in-memory, no Redis) @definition_store = Legate::GlobalDefinitionRegistry @logger.info('Agent Definition Store initialized (using GlobalDefinitionRegistry).') # Initialize Auth Manager Store (in-memory, no Redis) initialize_auth_manager_store # --- END MODIFICATION --- # Compile SASS/SCSS files in public/styles to CSS in public/css on application startup. # In production, we assume this was done during the build process. SassCompiler.compile_all if ENV['RACK_ENV'] == 'development' || Sinatra::Base.development? end |