Class: LittleGhost::CodeMode::ProgramResult

Inherits:
Data
  • Object
show all
Defined in:
lib/little_ghost/code_mode/types.rb,
lib/little_ghost/code_mode/types.rb

Overview

Describes one observation of a code-mode program. Its output contains text produced since the previous observation.

value carries the completed program's language value when the engine supports one. status is :completed, :still_working, :terminated, or :error. error contains a model-program error; lifecycle and cleanup failures raise instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output: "", value: nil, status: :completed, error: nil, artifacts: [], presentation_content: []) ⇒ ProgramResult

Creates a program observation with empty output and a successful status by default.



35
36
37
38
39
40
41
42
43
44
# File 'lib/little_ghost/code_mode/types.rb', line 35

def initialize(output: "", value: nil, status: :completed, error: nil, artifacts: [], presentation_content: [])
  super(
    output:,
    value:,
    status:,
    error:,
    artifacts: Array(artifacts).dup.freeze,
    presentation_content: Array(presentation_content).dup.freeze
  )
end

Instance Attribute Details

#artifactsObject (readonly)

Returns the value of attribute artifacts

Returns:

  • (Object)

    the current value of artifacts



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def artifacts
  @artifacts
end

#errorObject (readonly)

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def error
  @error
end

#outputObject (readonly)

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def output
  @output
end

#presentation_contentObject (readonly)

Returns the value of attribute presentation_content

Returns:

  • (Object)

    the current value of presentation_content



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def presentation_content
  @presentation_content
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def status
  @status
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



7
8
9
# File 'lib/little_ghost/code_mode/types.rb', line 7

def value
  @value
end

Instance Method Details

#completed?Boolean

Whether the program completed successfully.

Returns:

  • (Boolean)


47
# File 'lib/little_ghost/code_mode/types.rb', line 47

def completed? = status == :completed

#still_working?Boolean

Whether the program remains active after this observation.

Returns:

  • (Boolean)


50
# File 'lib/little_ghost/code_mode/types.rb', line 50

def still_working? = status == :still_working