Class: Nexo::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nexo/configuration.rb

Overview

Holds the harness-wide defaults. Accessed through Nexo.config and mutated through Nexo.configure. Every default is safe-by-default and provider-neutral — there is intentionally no hardcoded model.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Seeds the safe, provider-neutral defaults (no model, :virtual sandbox, :read_only permissions, :threaded concurrency).



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/nexo/configuration.rb', line 59

def initialize
  @default_model = nil # provider-neutral: NO hardcoded default
  @default_sandbox = :virtual # safe default
  @default_permissions = :read_only # safe default
  @skills_path = default_skills_path
  @concurrency = :threaded # async is opt-in; :threaded stays the default
  @max_in_flight = 8
  @buffer_workflow_events = false
  @session_chat_model = "Chat" # ruby_llm's own default acts_as_chat host
  @broadcast_events = false # safe default: opt in to the Turbo mirror
  @job_queue = nil # nil → ActiveJob's default queue
end

Instance Attribute Details

#broadcast_eventsObject

Whether to mirror run event notifications over Turbo Streams (Spec 11 R2), default false (safe-by-default). When true and turbo-rails is present, the engine subscribes Nexo::TurboBroadcaster at boot. The plain +nexo.workflow.event+/+nexo.workflow.status+ notifications fire regardless — this only gates the opt-in Turbo mirror.



50
51
52
# File 'lib/nexo/configuration.rb', line 50

def broadcast_events
  @broadcast_events
end

#buffer_workflow_eventsObject

Whether Workflow buffers events in memory and flushes once at the end of a run instead of persisting per emit (Spec 5), default false. Buffering avoids a blocking per-event DB write under a fiber reactor.



35
36
37
# File 'lib/nexo/configuration.rb', line 35

def buffer_workflow_events
  @buffer_workflow_events
end

#concurrencyObject

Concurrency mode (Spec 5): :threaded (default) | :async. This is the single switch that gates the Sandboxes::Local offload path — under :async its blocking file/shell I/O runs on a worker thread so it does not stall a fiber reactor; under :threaded it runs inline (zero overhead, byte-for-byte the Spec 1 behavior). It does NOT gate Nexo.concurrent, which always runs its own reactor when called.



26
27
28
# File 'lib/nexo/configuration.rb', line 26

def concurrency
  @concurrency
end

#default_modelObject

The default ruby_llm model id. nil means none chosen — provider-neutral.



9
10
11
# File 'lib/nexo/configuration.rb', line 9

def default_model
  @default_model
end

#default_permissionsObject

The default permission mode: :read_only.



15
16
17
# File 'lib/nexo/configuration.rb', line 15

def default_permissions
  @default_permissions
end

#default_sandboxObject

The default sandbox: :virtual (in-memory, zero host access).



12
13
14
# File 'lib/nexo/configuration.rb', line 12

def default_sandbox
  @default_sandbox
end

#job_queueObject

The ActiveJob queue Workflow.run_later enqueues onto (Spec 11 R1), default nil → ActiveJob's default queue. Set to a symbol (e.g. :nexo) to route workflow jobs to a dedicated queue.



55
56
57
# File 'lib/nexo/configuration.rb', line 55

def job_queue
  @job_queue
end

#max_in_flightObject

Max in-flight tasks for Nexo.concurrent fan-out (Spec 5), default 8. The single most important knob for staying under provider rate limits.



30
31
32
# File 'lib/nexo/configuration.rb', line 30

def max_in_flight
  @max_in_flight
end

#session_chat_modelObject

The host acts_as_chat model that stores Nexo::Session threads (Spec 10), given as a String class name (default "Chat" — ruby_llm's own default). It is constantized lazily at resume time so plain Ruby / no-ActiveRecord paths never reference an AR constant, mirroring how RunStore only touches Nexo::WorkflowRun when it is defined. The host app owns this model (columns

  • a unique (agent_name, instance_id) index); Nexo ships no migration for it.


43
44
45
# File 'lib/nexo/configuration.rb', line 43

def session_chat_model
  @session_chat_model
end

#skills_pathObject

Where SKILL.md packages live. Rails-aware: app/skills under the app root.



18
19
20
# File 'lib/nexo/configuration.rb', line 18

def skills_path
  @skills_path
end