Class: Space::Core::OciRunner
- Inherits:
-
Object
- Object
- Space::Core::OciRunner
- Defined in:
- lib/space_core/oci_runner.rb
Constant Summary collapse
- AUTH_ENV =
Always-forwarded substrate auth (the in-image architect/claude reach for these). Payload-specific vars are declared per-space via
run.env:or the --env flag. %w[ANTHROPIC_API_KEY CLAUDE_CODE_OAUTH_TOKEN ANTHROPIC_BASE_URL].freeze
Instance Method Summary collapse
- #command(extra = []) ⇒ Object
- #host_dirs ⇒ Object
- #image ⇒ Object
-
#initialize(space:, env: ENV.to_h, interactive: true, env_vars: []) ⇒ OciRunner
constructor
A new instance of OciRunner.
-
#missing_env ⇒ Object
Explicitly-requested vars (run.env: + --env) that are unset/empty in the host env, so the caller can warn — silence here would let a missing key fail opaquely inside the guest.
- #mounts ⇒ Object
Constructor Details
#initialize(space:, env: ENV.to_h, interactive: true, env_vars: []) ⇒ OciRunner
Returns a new instance of OciRunner.
14 15 16 17 18 19 |
# File 'lib/space_core/oci_runner.rb', line 14 def initialize(space:, env: ENV.to_h, interactive: true, env_vars: []) @space = space @env = env @interactive = interactive @env_vars = (space.run_env + Array(env_vars)).map(&:to_s) end |
Instance Method Details
#command(extra = []) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/space_core/oci_runner.rb', line 35 def command(extra = []) validated = validate_persist_paths(space.persist_paths) return validated if validated.failure? argv = [ "container", "run", "--rm", *(@interactive ? ["-i", "-t"] : []), *env_flags, *mount_flags, image, *extra ] Success(argv) end |
#host_dirs ⇒ Object
31 32 33 |
# File 'lib/space_core/oci_runner.rb', line 31 def host_dirs mounts.map(&:first) end |
#image ⇒ Object
21 22 23 |
# File 'lib/space_core/oci_runner.rb', line 21 def image "#{space.id}:latest" end |
#missing_env ⇒ Object
Explicitly-requested vars (run.env: + --env) that are unset/empty in the host env, so the caller can warn — silence here would let a missing key fail opaquely inside the guest. AUTH_ENV is opportunistic and intentionally excluded.
53 54 55 |
# File 'lib/space_core/oci_runner.rb', line 53 def missing_env @env_vars.uniq.reject { |var| present?(var) } end |
#mounts ⇒ Object
25 26 27 28 29 |
# File 'lib/space_core/oci_runner.rb', line 25 def mounts space.persist_paths.map do |guest| [space.path.join(".state" + guest), guest] end end |