2026-09-13 16:18:30 +00:00
|
|
|
package config
|
|
|
|
|
|
2026-11-21 22:42:35 +00:00
|
|
|
import (
|
2026-11-21 23:12:01 +00:00
|
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
2026-11-21 22:42:35 +00:00
|
|
|
"go.maximumdirect.net/promptkit"
|
|
|
|
|
)
|
2026-09-13 16:18:30 +00:00
|
|
|
|
2026-11-21 22:42:35 +00:00
|
|
|
// Document is the version 6 configuration shape decoded by ConfigKit. It is
|
2026-09-13 16:18:30 +00:00
|
|
|
// deliberately separate from Config so YAML presence and composition concerns
|
|
|
|
|
// do not reach runtime pipeline types.
|
|
|
|
|
type Document struct {
|
2026-11-21 22:49:41 +00:00
|
|
|
Version string `yaml:"version"`
|
|
|
|
|
PromptKit promptkit.Settings `yaml:"promptkit"`
|
|
|
|
|
Pipelines map[string]PipelineDocument `yaml:"pipelines,omitempty"`
|
|
|
|
|
Concurrency *ConcurrencyDocument `yaml:"concurrency,omitempty"`
|
|
|
|
|
Output *OutputDocument `yaml:"output,omitempty"`
|
|
|
|
|
CacheDirectory *string `yaml:"cache_directory,omitempty"`
|
|
|
|
|
Debug *DebugDocument `yaml:"debug,omitempty"`
|
2026-09-13 16:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PipelineDocument struct {
|
2026-11-21 23:12:01 +00:00
|
|
|
Mode *contracts.ExecutionMode `yaml:"mode,omitempty"`
|
2026-11-21 22:49:41 +00:00
|
|
|
MaxAdditionalTurns *int `yaml:"max_additional_turns,omitempty"`
|
2026-11-21 23:12:01 +00:00
|
|
|
Cache *contracts.CacheMode `yaml:"cache,omitempty"`
|
2026-11-21 22:49:41 +00:00
|
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
|
|
|
Input BindingDocument `yaml:"input"`
|
|
|
|
|
Chunk *BindingDocument `yaml:"chunk,omitempty"`
|
|
|
|
|
Artifacts map[string]ArtifactLaneDocument `yaml:"artifacts,omitempty"`
|
|
|
|
|
Steps []PipelineStepDocument `yaml:"steps,omitempty"`
|
|
|
|
|
Output *BindingDocument `yaml:"output,omitempty"`
|
|
|
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
2026-09-13 16:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PipelineStepDocument struct {
|
|
|
|
|
ID string `yaml:"id"`
|
|
|
|
|
Artifacts map[string]ArtifactLaneDocument `yaml:"artifacts"`
|
|
|
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArtifactLaneDocument struct {
|
|
|
|
|
Extract BindingDocument `yaml:"extract"`
|
|
|
|
|
Merge *BindingDocument `yaml:"merge,omitempty"`
|
|
|
|
|
Normalize *BindingDocument `yaml:"normalize,omitempty"`
|
|
|
|
|
Validators []ValidatorDocument `yaml:"validators,omitempty"`
|
|
|
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// BindingDocument represents a producer binding. ValidatorDocument is a
|
|
|
|
|
// deliberately finite subset so nested validator-only fields are rejected by
|
|
|
|
|
// ConfigKit's strict decoder.
|
|
|
|
|
type BindingDocument struct {
|
2026-11-21 23:12:01 +00:00
|
|
|
Mode *contracts.ExecutionMode `yaml:"mode,omitempty"`
|
2026-11-21 22:49:41 +00:00
|
|
|
MaxAdditionalTurns *int `yaml:"max_additional_turns,omitempty"`
|
2026-11-21 23:12:01 +00:00
|
|
|
Cache *contracts.CacheMode `yaml:"cache,omitempty"`
|
2026-11-21 22:49:41 +00:00
|
|
|
Module string `yaml:"module"`
|
|
|
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
|
|
|
Options map[string]any `yaml:"options,omitempty"`
|
|
|
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
|
|
|
Validators []ValidatorDocument `yaml:"validators,omitempty"`
|
2026-09-13 16:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ValidatorDocument struct {
|
2026-11-21 22:49:41 +00:00
|
|
|
Module string `yaml:"module"`
|
|
|
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
|
|
|
Options map[string]any `yaml:"options,omitempty"`
|
2026-09-13 16:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
2026-11-21 22:42:35 +00:00
|
|
|
// ReferenceDocument is the explicit version 6 union. Later document
|
2026-09-13 16:18:30 +00:00
|
|
|
// validation establishes which locations permit generated references and
|
|
|
|
|
// requires exactly one populated branch.
|
|
|
|
|
type ReferenceDocument struct {
|
|
|
|
|
Path *string `yaml:"path,omitempty"`
|
|
|
|
|
Artifact *ArtifactReferenceDocument `yaml:"artifact,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArtifactReferenceDocument struct {
|
|
|
|
|
Step string `yaml:"step"`
|
|
|
|
|
Lane string `yaml:"lane"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConcurrencyDocument struct {
|
2026-11-21 22:49:41 +00:00
|
|
|
Workers *int `yaml:"workers,omitempty"`
|
2026-09-13 16:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type OutputDocument struct {
|
|
|
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DebugDocument struct {
|
|
|
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
|
|
|
}
|