Validate providers and retain complete run debugging context

This commit is contained in:
2026-10-09 23:21:01 +01:00
parent f3d829bea5
commit 08b8647d5b
51 changed files with 1036 additions and 159 deletions
+16
View File
@@ -0,0 +1,16 @@
package pipeline
import (
"git.a-wan.net/alan/pipelines/internal/stage"
"strings"
)
// WithDefaultModel applies only to unpublished starter/example source. Never
// rewrite a persisted definition, retained draft, or pinned retry version.
func WithDefaultModel(source, model string) string {
provider, id, ok := strings.Cut(model, "/")
if !ok || !stage.ValidModel(provider, id) {
return source
}
return strings.NewReplacer("provider=opencode-go\n", "provider="+provider+"\n", "model="+stage.ModelID+"\n", "model="+id+"\n").Replace(source)
}