Implement Scriptorium subprocess adapter
This commit is contained in:
69
internal/adapters/scriptorium/runner.go
Normal file
69
internal/adapters/scriptorium/runner.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// Package scriptorium declares the adapter contract for Scriptorium CLI invocations.
|
||||
package scriptorium
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// CommandModeRun is the Scriptorium CLI mode for production generation.
|
||||
CommandModeRun = "run"
|
||||
// CommandModeRender is the Scriptorium CLI mode for debug/test rendering.
|
||||
CommandModeRender = "render"
|
||||
)
|
||||
|
||||
// Runner is the adapter boundary for Scriptorium artifact invocations.
|
||||
type Runner interface {
|
||||
RunArtifact(ctx context.Context, req RunArtifactRequest) (ArtifactResult, error)
|
||||
RenderArtifact(ctx context.Context, req RenderArtifactRequest) (ArtifactResult, error)
|
||||
}
|
||||
|
||||
// RunArtifactRequest describes a production artifact-generation invocation.
|
||||
type RunArtifactRequest struct {
|
||||
Binary string
|
||||
ConfigPath string
|
||||
PromptID string
|
||||
ProfileID string
|
||||
InputPaths map[string]string
|
||||
Vars map[string]string
|
||||
OutputPath string
|
||||
StdoutLogPath string
|
||||
StderrLogPath string
|
||||
GeneratedConfigPath string
|
||||
Timeout time.Duration
|
||||
APIKeyEnv string
|
||||
WorkingDir string
|
||||
}
|
||||
|
||||
// RenderArtifactRequest describes a render-debug invocation.
|
||||
type RenderArtifactRequest struct {
|
||||
Binary string
|
||||
ConfigPath string
|
||||
PromptID string
|
||||
ProfileID string
|
||||
InputPaths map[string]string
|
||||
Vars map[string]string
|
||||
OutputPath string
|
||||
StdoutLogPath string
|
||||
StderrLogPath string
|
||||
GeneratedConfigPath string
|
||||
Timeout time.Duration
|
||||
APIKeyEnv string
|
||||
WorkingDir string
|
||||
}
|
||||
|
||||
// ArtifactResult describes Scriptorium invocation output and provenance.
|
||||
type ArtifactResult struct {
|
||||
OutputPath string
|
||||
StdoutLogPath string
|
||||
StderrLogPath string
|
||||
GeneratedConfigPath string
|
||||
ExitCode int
|
||||
Duration time.Duration
|
||||
CommandMode string
|
||||
PromptID string
|
||||
ProfileID string
|
||||
ValidationFailed bool
|
||||
Metadata map[string]any
|
||||
}
|
||||
Reference in New Issue
Block a user