Module: Hermetic::Backends::Hosted

Defined in:
lib/hermetic/backends/hosted.rb,
lib/hermetic/backends/hosted/e2b.rb

Overview

Factory for vendor-cloud sandboxes — off-host by construction (spec §3): the guest lives in the vendor's cloud and this process holds only an API key. E2B ships in v1; Daytona/Modal are named but deferred so the constructor fails with the roadmap, not a NameError.

Defined Under Namespace

Classes: E2B

Constant Summary collapse

PROVIDERS =
{ e2b: :E2B }.freeze
DEFERRED =
%i[daytona modal].freeze

Class Method Summary collapse

Class Method Details

.build(provider, **opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hermetic/backends/hosted.rb', line 13

def self.build(provider, **opts)
  key = provider.to_s.downcase.to_sym
  if DEFERRED.include?(key)
    raise ConfigError, "hosted provider #{key.inspect} is deferred (v1.1) — :e2b is the v1 provider"
  end

  const = PROVIDERS.fetch(key) do
    raise ConfigError,
          "unknown hosted provider #{provider.inspect} (known: #{PROVIDERS.keys.inspect}, deferred: #{DEFERRED.inspect})"
  end
  const_get(const).new(**opts)
end