Skip to content

Commit

Permalink
Orchestra; create sealed class CommandOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 16, 2024
1 parent 0f7b418 commit b76d5e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ object TestDebugReporter {
val commandsFilename = "commands-(${flowName.replace("/", "_")}).json"
val file = File(path.absolutePathString(), commandsFilename)
commandMetadata.map {
CommandDebugWrapper(it.key, it.value) }.let {
CommandDebugWrapper(it.key, it.value)
}.let {
mapper.writeValue(file, it)
}
}
Expand Down
12 changes: 12 additions & 0 deletions maestro-orchestra/src/main/java/maestro/orchestra/Orchestra.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ import java.io.File
import java.lang.Long.max
import java.nio.file.Files

// TODO(bartkepacia): Use this in onCommandGeneratedOutput.
// Caveat:
// Large files should not be held in memory, instead they should be directly written to a Buffer
// that is streamed to disk.
// Idea:
// Orchestra should expose a callback like "onResourceRequested: (Command, CommandOutputType)"
sealed class CommandOutput {
data class Screenshot(val screenshot: Buffer) : CommandOutput()
data class ScreenRecording(val screenRecording: Buffer) : CommandOutput()
data class AIDefects(val defects: List<Defect>, val screenshot: Buffer) : CommandOutput()
}

class Orchestra(
private val maestro: Maestro,
private val stateDir: File? = null,
Expand Down

0 comments on commit b76d5e1

Please sign in to comment.