Module: LanguageOperator::Constants
- Included in:
- LanguageOperator::CLI::Commands::Agent::Base, LanguageOperator::CLI::Commands::Cluster, LanguageOperator::CLI::Commands::Model::Base, LanguageOperator::CLI::Commands::Persona, LanguageOperator::CLI::Commands::Status, LanguageOperator::CLI::Commands::Tool::Base
- Defined in:
- lib/language_operator/constants.rb,
lib/language_operator/constants/kubernetes_labels.rb
Overview
Shared constants used across the Language Operator gem
Defined Under Namespace
Modules: KubernetesLabels
Constant Summary collapse
- EXECUTION_MODES =
Agent execution modes with their aliases Primary modes are the canonical forms used in CRD schemas Aliases are accepted for backwards compatibility and convenience
{ autonomous: %w[autonomous interactive].freeze, scheduled: %w[scheduled event-driven].freeze, reactive: %w[reactive http webhook].freeze }.freeze
- PRIMARY_MODES =
Primary (canonical) execution modes for schema definitions
%w[autonomous scheduled reactive].freeze
- ALL_MODE_ALIASES =
All valid mode strings (primary + aliases)
EXECUTION_MODES.values.flatten.freeze
- RESOURCE_AGENT =
Kubernetes Custom Resource Definitions (CRD) kinds These replace magic strings scattered across CLI commands
'LanguageAgent'- RESOURCE_AGENT_VERSION =
'LanguageAgentVersion'- RESOURCE_MODEL =
'LanguageModel'- RESOURCE_TOOL =
'LanguageTool'- RESOURCE_PERSONA =
'LanguagePersona'
Class Method Summary collapse
-
.normalize_mode(mode_string) ⇒ String
Normalizes a mode string to its primary canonical form.
-
.valid_mode?(mode_string) ⇒ Boolean
Validates that a mode string is recognized.
Class Method Details
.normalize_mode(mode_string) ⇒ String
Normalizes a mode string to its primary canonical form
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/language_operator/constants.rb', line 31 def self.normalize_mode(mode_string) return nil if mode_string.nil? mode_string = mode_string.to_s.downcase.strip # Handle empty/whitespace mode strings with specific error message if mode_string.empty? raise ArgumentError, 'AGENT_MODE environment variable is required but is unset or empty. ' \ "Please set AGENT_MODE to one of: #{ALL_MODE_ALIASES.join(', ')}" end EXECUTION_MODES.each do |primary, aliases| return primary.to_s if aliases.include?(mode_string) end raise ArgumentError, "Unknown execution mode: #{mode_string}. " \ "Valid modes: #{ALL_MODE_ALIASES.join(', ')}" end |
.valid_mode?(mode_string) ⇒ Boolean
Validates that a mode string is recognized
54 55 56 57 58 |
# File 'lib/language_operator/constants.rb', line 54 def self.valid_mode?(mode_string) return false if mode_string.nil? ALL_MODE_ALIASES.include?(mode_string.to_s.downcase.strip) end |