Class: AgentHarness::ExecutionPreparation

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_harness/execution_preparation.rb

Overview

Structured runtime bootstrap contract for request-scoped executor setup.

Providers can use this to request file materialization or similar preparation without forcing downstream applications to shell-wrap the main provider command.

Defined Under Namespace

Classes: FileWrite

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_writes: []) ⇒ ExecutionPreparation

Returns a new instance of ExecutionPreparation.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/agent_harness/execution_preparation.rb', line 27

def initialize(file_writes: [])
  writes = file_writes || []
  unless writes.is_a?(Array)
    raise ArgumentError, "file_writes must be an Array (got #{writes.class})"
  end

  @file_writes = writes.map.with_index do |write, index|
    case write
    when FileWrite
      write
    when Hash
      FileWrite.new(
        path: fetch_value(write, :path),
        content: fetch_value(write, :content),
        mode: write.key?(:mode) ? write[:mode] : write["mode"]
      )
    else
      raise ArgumentError,
        "file_writes must contain FileWrite or Hash entries; invalid element at index #{index}: #{write.inspect} (#{write.class})"
    end
  end.freeze

  freeze
end

Instance Attribute Details

#file_writesObject (readonly)

Returns the value of attribute file_writes.



25
26
27
# File 'lib/agent_harness/execution_preparation.rb', line 25

def file_writes
  @file_writes
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/agent_harness/execution_preparation.rb', line 52

def empty?
  file_writes.empty?
end